Defender Kyle McAusland scored an 88th-minute winner at East Fife to claim Ayr United's first victory of the season.
Both sides were without a win before the match, and it was the hosts who went ahead after five minutes, Jamie Pollock finding the bottom corner with a low drive.
The Honest Men were back on level terms just four minutes later, David Sinclair tapping in after good work by Michael Moffat.
Sinclair then gave the visitors the lead with his second goal of the afternoon, a clinical left-footed finish after 34 minutes.
Seven minutes from time, Robert Barr let fly with a stunning 25-yard volley which found the top corner to draw the Fifers level.
But caretaker manager Gordon Chisholm's side were unable to hold onto their point as McAusland headed in Sinclair's corner late on to give Mark Roberts' team a last-gasp victory.
East Fife: Collier, Durie, Campbell, Forster, Cook (Robert Sloan 78), Willis, Darren Smith, Pollock (Muir 57), Robert Barr, Wardlaw (McBride 67), Paul McManus. Subs Not Used: Shaw, McCormack.
Booked: Paul McManus, Forster.
Goals: Pollock 5, Robert Barr 83.
Ayr: Alistair Brown, McAusland, John Robertson, McCann, Twaddle, Crawford, Sinclair, McStay (Ross Robertson 66), Hunter (Shankland 79), Moffat, Mackinnon (Winters 74). Subs Not Used: Martin, Brownlie.
Booked: Mackinnon, Crawford.
Goals: Sinclair 9, 34, McAusland 88.
Ref: Gary Hilland