Peterhead had the best of the opening period, and Craig Campbell had two good chances to give them the lead. Firstly, Jamie Buchan played a neat one-two with Martin Bavidge before releashing Campbell, who had his shot pushed away by the keeper.
Campbell again was involved when Robert Linn turned and gave the on-loan Ross County man space to shoot, but he was unlucky to seek his shot block by Mark Peat.
The visitors took a shock lead when former Gretna man Wayne Gordon's cross evaded Paul Mathers and went in off the far post.
But the Blue Toon equalised through Robert Linn, the club captain rising to head home a David Hagen corner kick.
Peterhead looked like gaining the lead through Martin Bavidge, but with keeper Peat beaten, his low effort was cleared off the line by Danny Black.
However, the visitors regained the initiative through Graeme McCaul who slotted home after seeing his initial effort cleared by Mathers. They extended their lead with six minutes remaining through substitute Garry Fleming.
However, the Blue Toon pulled a goal back in injury time with Graeme Stewart stroking the ball home after his first effort was blocked by Peat.