After 68 minutes, Ayr's Michael Moffat slotted home the second of the day.
Peterhead sub Dennis Wyness was brought down inside the box by Ebbie Malone and slotted in the resulting penalty, but it wasn't enough to force a draw.
Peterhead: Jarvie, Donald, Stuart Smith, Mann, MacDonald, Stirling Smith (Moore 56), McVitie, Nicholas Clark (Sharp 46), Emslie, Gethans (Wyness 72), Bavidge. Subs Not Used: Bateman, Strachan.
Booked: McVitie, MacDonald.
Goals: Wyness 81 pen.
Ayr: Martin, Lauchlan, Malone, Campbell, Smith, Trouten, McLaughlin, McCann, Willis (Easton 65), Moffat, Roberts (Rodgers 71). Subs Not Used: Crawford, Tiffoney, Bannigan.
Booked: Lauchlan, Malone, Campbell.
Goals: Trouten 24, Moffat 68.
Ref: John Beaton
Source: BBC Sport