A last-gasp winner from Liam Buchanan denied Fraserburgh a league scalp as Cowdenbeath advanced in the SPFL Trust Trophy.
Fraserburgh dominated the game but were unable to take their chances, with Cowdenbeath snatching an unlikely winner at the death.
They will now advance to face Alloa Athletic in the second round next month.
Mark Cowie made six changes from the 6-2 win over Brora Rangers, drafting in Gary Harris, Jamie Beagrie, Ryan Sargent, Lewis Duncan, Logan Watt and Edward Flinn. Paul Leask, Bryan Hay, Kieran Simpson, Paul Young, Sean Butcher and Scott Barbour dropped out.
Cowdenbeath were fresh from a 3-1 win over Elgin City in League Two but there was little to separate the two sides in the first half at Bellslea.
The first opening of the game fell to the home side, with Grant Campbell releasing his namesake Paul with a raking pass out to the right flank. He got the better of Ross Clarke and rolled the ball back to Lewis Duncan at the edge of the box, with his first-time shot zipping over.
Duncan was a lively presence in the middle of the park and looked the likely orchestrator for a Fraserburgh opening.
Cowdenbeath were kept busy at the back, with Sargent nearly finding an opening. Willie West’s arced pass picked out Sargent and visiting goalkeeper Cameron Gill’s position looked precarious. However, the Broch forward was unable to connect cleanly and his shot rolled harmessly to Gill.
Gary Bollan’s side were offering little in attack with Fraser Mullen’s free-kick, which drifted harmlessly wide, the nearest they came to a shot at goal in the first period.
Fraserburgh had controlled large parts of the play but were yet to force Gill into a meaningful save, with Harris not in the game up front.
The hosts, who have already tasted cup success recently in the Aberdeenshire Cup, looked to press home their superiority early in the second period and threatened Gill’s goal early.
Sargent ought to have done better when he was put through by Watt’s slide-rule pass but in attempting to round the goalkeeper, lost the ball and Cowden survived.
Duncan then won and took a free-kick 25 yards from goal, with a dipping effort just creeping wide of the near post.
Cowden’s best chance of a goal looked to be from a set-piece but they were half-chances at best, with Mullen sending one free-kick over and Kyle Miller doing like-wise.
Substitute Paul Young could only turn a near-post header wide after being picked out by Duncan’s corner before another break that carved Cowden open.
A first-time ball from Duncan released Paul Campbell and with the angle narrowing, he looked to pick out the newly-introduced Barbour at the back post. Mullen was able to intervene before the Fraserburgh forward was able to tap in.
Mullen’s defensive contributions were not over as a last-ditch intervention was needed to prevent Ryan Cowie from finishing Duncan’s cross, as the Broch turned the screw.
Paul Campbell tried his luck again, this time prodding through a crowd of players after a goalmouth scramble, but fortunately for the away side it went straight at Gill.
The winner came in stoppage-time and after weathering so much pressure throughout the game, Buchanan appeared at the back post to crash home and seal Cowden’s progress.