Dunfermline came back from two goals down to win 4-2 at Ayr.
There were few chances before Ayr opened the scoring in bizarre fashion on 17 minutes. Brian Gilmore hit the ball over keeper Ryan Scully from his own half, with the wind playing a big part.
The away side were left to rue their luck again 10 minutes later as a poor back-pass was picked up and finished by Michael Moffat.
Dunfermline were back in it on the stroke of half-time when Stephen Husband's unstoppable 20-yard curling strike flew in.
They drew level as Ryan Wallace struck a penalty into the bottom-right corner on the hour mark before Wallace completed Dunfermline's comeback with 68 minutes gone to send them into the lead.
Jordan Moore secured all three points for the Pars with a chipped effort in stoppage time.