East Fife goalkeeper Mark Ridgers saved three penalties in a shoot-out as Aberdeen were knocked out of the Scottish Communities League Cup.
Ryan Wallace's 31st minute opener for the visitors was cancelled out by a Rory McArdle header 10 minutes later.
Darren Mackie hit the Dons' second then Matthew Park levelled for East Fife.
Robert Sloan's strike looked to have won it for the Fifers but Rory Fallon's injury-time penalty for Aberdeen took the game into goalless extra-time.
The Dons, who have made a habit of exiting cup competitions to lower league sides in recent seasons, were 6-0 winners when the teams met in the Scottish Cup in January but this tie was very different.
The East Fife players mob their hero-keeper Mark Ridgers
The part-timers served the Dons a warning that an upset was on the cards when Wallace received Robert Ogleby's cross and smashed the ball high into the net just after the half-hour mark.
McArdle's header from a Ryan Jack free-kick five minutes before half-time and Mackie's goal two minutes after the break, the striker first to react when Ridgers palmed away a Scott Vernon shot, should have set the Dons on the road to victory.
But two goals in as many minutes from Park and Sloan gave John Robertson's side a 3-2 lead and they looked to be heading into the quarter-finals.
Park's goal was spectacular, a first-time effort from 25 yards that sailed straight into the top corner after 54 minutes, and the Fifers' third was the product of a pass by Wallace to play in the scorer Sloan for a cool finish.
But there was so much drama still to come.
Steven Hislop brought down Mohamed Chalali in the box deep into injury time and New Zealand striker Fallon took the game into extra time with his penalty goal.
When 30 minutes of extra time finished goalless, the match was decided by a penalty shoot-out and it was the Fifers who kept their nerve, with Aberdeen's Fallon, Josh Magennis and Chris Clark having their spot-kicks saved by the hero Ridgers.
East Fife manager John Robertson:
"I have been lucky enough to be involved in a lot of giant killing acts in the past but that was sensational.
"I thought we played super stuff in the first half and what really delighted me was the quality of the goals. I thought all three goals were absolutely magnificent and well worked.
"Aberdeen's main weakness this season has been at the back and we knew our players could get forward and hurt them.
"We told them that they had nothing to fear. They were dropping like flies in extra time with cramp but they hung in there and in the end I don't think anybody would deny that we were worthy of our victory."
Aberdeen manager Craig Brown:
"I would say that was arguably the worst result of my managerial career.
"We didn't play at all. I possibly made a mistake by changing the team too much and leaving out good players from the start thinking we had enough in reserve to cope with this fixture.
"I have never considered my own position at all and even after tonight I'm determined.
"If other people consider it there is nothing I can do about that - I just have to get on with my job conscientiously."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.