Cupar Hearts travelled to bottom of the League side Rosyth in the third round of the Challenge Cup.
The home side stunned the visitors when they grabbed the opener with only three minutes on the clock when James McPherson slotted the ball into the net.
At the other end a handball by Mark McPherson gave Hearts a free kick opportunity at the edge of the box but Grant Blyth’s kick was deflected inches wide.
The equaliser came when Jakub Dobes found striker Kyle Watson at the back post for an easy tap in.
Hearts took the lead just before the break in spectacular style when Kerr Brown stepped up and blasted the ball in off the crossbar from 30 yards.
A third came when Gordon McKinnon put in a cross for Watson to slide the ball over the line.
Hearts let the home side back into the game when a foul by Kerr Brown on Patrick Murphy saw the referee point to the spot. And despite ‘keeper Gavin Wilson going the right way he couldn’t keep out Mark McPherson’s penalty kick.
On Saturday Cupar Hearts travel to face Blantyre in the third round of the Scottish Cup. Kick off 2PM.
Cupar Hearts - Wilson, Blyth, McInroy, Leadbetter, G. Brown, Dobes, K. Brown, McKinnon, Sibanda, Pennington and Watson.
Subs - Anderson, Laurie.