Leighton McIntosh's 89th minute strike settled a closely-fought encounter in favour of the Blue Toon after Michael Moffat's first half header looked to have secured the Pars a hard-earned point.

Rory McAllister had fired the hosts into a 30th minute lead from the penalty spot after Josh Falkingham had upended Nicky Riley inside the area before Moffat's 44th minute leveller.

The result was hard to take for Allan Johnston's team who had been in the ascendency for much of the second period and looked the team most likely to earn a victory that would have kept them at the summit of League One.

For the first time this campaign, the Pars boss was forced into shuffling his starting line-up after Ryan Williamson's double leg break at Forfar last Tuesday, meaning a switch to right back for Lewis Martin and a start for Jason Talbot.

The early signs suggested that this was going to be a tough assignment for Athletic and Jordan Brown forced Sean Murdoch into a smart block in eight minutes, before firing another effort over the bar.

Peterhead were forced into a change in the 20th minute when McIntosh replaced the injured Jamie Stevenson but they continued to put pressure on the Pars box, although Joe Cardle had a shot blocked by Ally Gilchrist.

Falkingham was then introduced for Shaun Byrne in a tactical switch by Johnston, but minutes later the midfielder conceded a spot kick for fouling Riley.

McAllister made no mistake from 12 yards but the Pars, who had struggled to fashion any clear-cut chances, hauled themselves level a minute before the break.

Andy Geggan's blocked shot fell to Faissal El Bakhtaoui, who then set up Cardle to cross for Moffat at the back post to steer an excellent header beyond the reach of Peterhead goalkeeper Graeme Smith.

Dunfermline started the second half well but Murdoch had to be alert to beat away Shane Sutherland's free-kick before Smith produced a fine save at the other end from El Bakhtaoui.

Michael Paton was next to have a go, flashing a 25-yard shot over the bar, and appeals for a penalty after Falkingham went down under James Redman's challenge were waved away by referee Craig Charleston.

The visitors continued to press with Ben Richards-Everton having a shot blocked before Moffat was desperately unlucky with a spectacular overhead kick that Smith did well to push over for a corner.

Scott Ferries, who had spent time on trial with the Pars in pre-season, threatened at the other end but Murdoch again saved well before McIntosh sent a powerful effort off target.

Substitute Ryan Wallace was the next Pars player to be left frustrated by Smith as his shot from distance was well saved before El Bakhtaoui threatened twice in the space of a minute.

But with only a minute to go, disaster struck as Peterhead broke to score the winner.

After a controversial offside call at a Pars free-kick played into the home box, a swift move forward saw McAllister latch on to a through ball and feed McIntosh, who beat Richards-Everton to the ball before lifting it beyond Murdoch and into the net.

Peterhead: Smith, Stevenson (McIntosh 20), Strachan, Gilchrist, Blockley (Ferries 61), Redman, Dzierzawski, Brown, Riley, Sutherland (Rodgers 64), McAllister.

Subs not used: Adams, Baptie, Lawrence, Jarvie.

Goals: McAllister (30 pen.), McIntosh (89).

Booked: McAllister (15), Brown (29), Riley (37), Strachan (66).

Pars: Murdoch Martin, Fordyce, Richards-Everton, Talbot, Paton (Hopkirk 83), Byrne (Falkingham 27), Geggan, Cardle (Wallace 77), Moffat, El Bakhtaoui.

Subs not used: Trialist, Potter, Hutton.

Goal: Moffat (44).

Booked: Paton (18), Geggan (32).

Referee: Craig Charleston.

Attendance: 996.