Super Lig Wrap: Bizarre Ba goal benefits Besiktas
Besiktas moved into a 1-0 lead in Sunday's encounter at the Recep Tayyip Erdogan Stadium when Olcay Sahan scored on the half-hour mark.
Slaven Bilic's men were pegged back just after the hour as Sinan Kaloglu levelled for Mersin.
However, the sides were level for just four minutes as Besiktas earned a fortuitous winner.
Ba's initial shot was saved by Nikolay Mihaylov, but the ball rebounded back off the striker, who had fallen to the floor, and spooned into the net for his 10th league goal of the campaign.
Galatasaray slipped three points off the pace on Sunday after being held 2-2 at home by Bursaspor.
The visitors overcame Umut Bulut's early opener to move ahead thanks to goals from Volkan Sen and Fernandao.
However, third-placed Gala rescued a draw through Emre Colak's 82nd-minute penalty.
Also on Sunday, Rizespor moved out of the bottom three with a 2-0 win at Genclerbirligi - who had Jean-Jacques Gosso sent off - while Konyaspor ended a five-match winless league run by beating Eskisehirspor 1-0.
Fenerbahce remained top of the table after winning 2-1 at struggling Karabukspor on Saturday to stretch their unbeaten league run to 12 matches.
Selcuk Sahin put the visitors ahead in the seventh minute, before Emmanuel Emenike ended a near three-month wait for a league goal in the second half to down his former team. The Nigeria international later apologised to the Karabukspor supporters for celebrating his goal.
Also on Saturday, Sivasspor - who sit in the relegation zone - produced a second-half comeback to beat Gaziantepspor 3-1, the hosts capitulating when Gilles Binya was sent off in the 53rd minute, while Istanbul Basaksehir won 1-0 at Kasimpasa.
Akhisar Belediyespor were held 2-2 at home by Balikesirspor on Friday and Trabzonspor defeated Kayseri Erciyesspor 2-1.