Ayr United 1 Peterhead 2
The home side got off to a great start when Gareth Wardlaw struck from 16 yards to put them in front but they never looked comfortable.
Further chances fell to Chris Robertson and Jerome Vareille and when they missed Ayr were destined to be punished.
The Blue Toon flew out of the blocks in the second half and passed up numerous chances to equalise.
Chris Hegarty and Stuart McKay were the worst offenders as they each blew two great opportunities in front of goal.
They finally made their dominance pay in the 72nd minute when Graeme Sharp raked home a low drive from 20 yards.
And they sealed the points less than a minute later when McKay crashed home a shot from the edge of the box.
Ayr's misery was compounded in stoppage time when David Lowing was given a straight red card for a wild lunge at Peterhead goalscorer McKay.