A superbly entertaining match saw Ayr’s promotion charge dented by a Cowdenbeath side who have the top four in their sights.
The Blue Brazil ripped into the visitors who had keeper Greg Fleming to thank for stopping Cowdenbeath’s tally hitting six.
Ayr had a dream start though in only two minutes when a long ball caught out the Cowden defence and Ross Caldwell broke clean through and coolly fired the ball low past Jamie Sneddon.
But within two minutes Cowdenbeath were level. Greig Spence fired in a low shot which Fleming managed to block but only as far as Dean Brett who blasted home from only six yards out.
In 11 minutes the Blue Brazil were in front. Fleming blocked a Declan Hughes effort and Spence shot low into the net from close in.
Five minutes from the break the home side went 3-1 ahead. Spence robbed the Ayr central defence and fed Kenny Adamson and his fierce drive bounced to Gordon Smith and the striker fired home from 12 yards.
But at the other end in 57 minutes Fleming produced a fantastic save from Smith’s brilliant flick from Hughes’ cross.
Then Ayr pulled one back. Sub Preston scored from close in after Caldwell had created the danger.
Almost immediately Spence hit the underside of the United bar, then Brett’s header was heading for the top corner and Fleming got a hand to it to keep his team in the game.
However, there was nothing the keeper could do in the 66th minute. Brett’s fierce cross was met by Spence and his volley made it 4-2.
The hosts could have added to their tally with Fleming denying Spence his hat-trick.
Cowden boss Colin Nish said: “It was a fantastic game and I felt we deserved to take all three points.”
Attendance 640.
Cowdenbeath: Sneddon; Donaldson, Adamson; Scullion, Kerr, Hughes; Brett, Murdoch, Spence, Smith (Johnston 90), Callaghan. Subs not used, El Zubaidi, Yakub, Kane, Milne, Armstrong and Trialist.
Ayr United: Fleming; Devlin, Donald; Graham (McCracken 55), McLauchlan, Stevenson; Murphy, Crawford, Caldwell, Trouten (Preston 46), Forrest (Muir 70). Subs not used: McKenzie, McCracken, Newman.
Referee George Salmond.