Darren Gribben scored his seventh goal of the season to help Arbroath defeat Ayr 4-2 at Gayfield.
The Honest Men took the lead after 22 minutes thanks to David Sinclair's free-kick.
The hosts were level on the stroke of half-time, however, when Arbroath substitute Derek Holmes applied the finish to Gribben's outswinging corner.
Brian Kerr's drilled effort two minutes after the interval then put the Red Lichties ahead before Holmes put the ball into his own net after 67 minutes to level the scores.
Grubben volleyed the home team back into the lead just five minutes later after Lee Sibanda nodded the ball into his path.
All three points points were secured seven minutes from time when David Rennie headed home from close range.