A stunning strike from East Fife's Scott Dalziel dumped top-flight Dunfermline out of the League Cup.
The Second Division side were rewarded for an impressive opening when Bobby Linn fired in a fourth-minute strike.
Dunfermline levelled 10 minutes later as Liam Buchanan slid in to prod home from close range.
But East Fife took a deserved lead again 10 minutes into the second half, with Dalziel crashing in a super effort from the edge of the penalty box.
The Premier League visitors almost took the tie to extra-time with the last action of the game, but Steven Hislop made a fine goal-line clearance.
Prior to Linn's early breakthrough, Ryan Wallace had missed a gilt-edged chance - shooting high over the crossbar after a lofted Craig Johnstone through-ball had sent him clear.
And John Robertson's side continued to create the best chances, with Gallacher saving from Linn's curling free kick after the break and Robert Sloan shooting over the top from a set-piece.
Linn and Wallace squandered further opportunities late in the game as the SPL side struggled to match the energy of their part-time opponents.
And East Fife's John Robertson, who also managed Inverness Caledonian to a famous Scottish Cup win over Celtic in 2003, described it as one of the best of his management career.
East Fife manager John Robertson: "For me, it's up there with the Celtic result.
"It's just unbelievable. I thought we dominated the game.
"We were sharp, inventive and if it wasn't for Paul Gallacher keeping the score down then we could have won by more."
Dunfermline manager Jim McIntyre: "The best team won and there's no getting away from that.
"We weren't at the races; didn't start well and continued like that through the night.
"It's a bad day at the office and we're gutted we're out the cup, but we got exactly what we deserved.
"It's a horrible night. We've taken some great praise in recent weeks, so let's take this one on the chin."