Forfar twice came from behind in a thrilling second division clash that was packed with stunning goals and plenty of incident.
Strikes from Ross Campbell and Martyn Fotheringham and a Jim Lauchlan own goal ended a run of poor form for the Loons at Station Park.
Manager Dick Campbell said, “That was a bit more like Forfar. I don’t think we deserved to go in 1-0 down and I told them not to panic.
“Someone gave me a wee stat at half-time and said we had 62% of the possession. I thought the elements played a part in the second-half and we handled them better than Ayr.”
The visitors came close on five minutes when Michael Moffat’s strike was pushed past the post by Scott Gallacher.
On 14 minutes a corner fell to Mark Roberts in the six-yard box, but his flick struck the crossbar.
Ross Campbell raced clear on the right on 22 minutes, played the ball across the box to Paul McQuade, whose neat flick to the feet of Ryan Dow was fired just wide from eight yards.
Ayr took the lead against the run of play in the 36th minute when Roberts broke clear down the left and played in a low cross which Alan Trouten stabbed home from six yards.EqualiserForfar equalised five minutes after the break through Ross Campbell, after a Chris Templeman lay-off.
The unmarked Moffat headed over from close range for Ayr minutes later.
On 59 minutes, Mark McCulloch struck the bar from the edge of the box.
Ross Campbell then went on a solo run into the box, beating a string of players, but his low finish was saved by Martin.
The rebound fell to McQuade, but Martin somehow pushed the ball past the post and out for a corner.
The Honest Men took the lead on 70 minutes through Scott McLaughlin. The midfielder’s left-foot shot beat the despairing Gallacher from distance.
It proved a night for eye-catching goals as substitute Martyn Fotheringham curled a right-foot free-kick into the top corner from 25 yards out.
Forfar took the lead on 82 minutes as Fotheringham put in a corner from the left, which glanced off the head of Ayr defender Jim Lauchlan and into the net.Attendance 341.Forfar Gallacher, Ross, McCulloch, Bolochoweckyj, Bishop, Iain Campbell (Sellars 77), Hilson (Fotheringham 63), Templeman, Ross Campbell, McQuade, Dow (Deasley 45). Subs not used Gibson, Duffy.Ayr United Martin, Lauchlan, Malone, Donnelly, Martyn Campbell, McCann, Trouten (David Crawford 58), McLaughlin, Moffat, Roberts, Easton (Bannigan 69). Subs not used Rodgers, Smith, David Crawford.Referee Gary Hilland.