Besiktas were thankful for a strange Demba Ba winner as they remained one point behind Turkish Super Lig leaders Fenerbahce.
A bizarre goal from Demba Ba helped Besiktas to a scrappy 2-1 over Mersin Idmanyurdu to maintain the pressure on Turkish Super Lig leaders Fenerbahce, who defeated Karabukspor by the same scoreline.
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.