Dunfermline suffered a nightmare last-minute Uefa Cup exit at the hands of Iceland's FH Hafnarfjordur.
The Pars players are left stunned after their Uefa Cup defeat
Tommy Nielsen netted the winner for the visitors only seven minutes after substitute Armann Bjornsson had cancelled out Gary Dempsey's opener.
The Pars controlled most of the game and looked sure to progress when Dempsey smashed home on 70 minutes.
But the two late goals saw the men from Reykjavik win 2-1 on the night and 4-3 on aggregrate.
A gutted Pars boss Davie Hay said afterwards that the defeat was a "massively bad result for the club".
Hafnarfjordur's assistant manager Olafur Johannesson was however delighted with the outcome, which saw his side progress as the first Icelandic side ever to make it through two rounds in Europe.
He said: "This is the biggest game in our history and certainly the biggest result, it is terrific."
The game at a rainy McDiarmid Park kicked off five minutes late after traffic congestion prevented hundreds of fans from gaining entry on time - with some still taking their seats 30 minutes into the first half.
The match was switched to St Johnstone's McDiarmid Park after Hafnarfjordur objected to the artificial surface at East End Park.
The Pars started brightly but they lacked a cutting edge when it counted, spurning three early chances in the first ten minutes.
The first opportunity fell to veteran striker Craig Brewster, but his swivel and shot in the box was deflected wide by the Hafnarfjordur goalkeeper Larusson.
Dempsey then presented Andrei Skerla with a free header, but he failed to hit the target.
Derek Young also had an opportunity to convert the home side's pressure, but he blasted his shot high over bar.
On 31 minutes, Dempsey almost broke the deadlock, but his 20-yard drive flew narrowly over the crossbar.
The best chance of the opening half arrived at Noel Hunt's feet in 34 minutes, but Larusson blocked his shot with his legs when it seemed a goal was inevitable.
The whistle had barely gone after the break when Young whipped in a good cross from the left and the ball was met by Brewster - but the striker didn't get enough pace on his header to worry Larusson.
Against the run of play, Dunfermline survived a narrow escape on 57 minutes as a 30-yard strike from Emil Hallfredsson bounced back off the underside of Stillie's crossbar with the keeper beaten.
The East End Park side made the crucial breakthrough after 26 minutes of the second half.
Shields made a surging run to the byline and delivered a cross which Larusson couldn't collect under pressure from Brewster.
The ball fell to Dempsey and the Irishman hammered the ball into the net with his right foot.
Noel Hunt could have sealed it minutes later, but his effort from six yards out was intercepted by Nielson.
Hafnarfjordur equalised with eight minutes to go, Bjornsson knocking the ball beyond Stillie after some slack defending from the home team.
Then Nielson broke the home fans' hearts with his snatched winner at the death.
Dunfermline: Stillie, Shields, Scott Wilson, Skerla, Scott Thomson (Byrne 85), Derek Young (Donnelly 85), Darren Young, Mason (Tod 90), Dempsey, Hunt, Brewster.
Subs Not Used: Langfield, Lyle, Labonte, Mehmet.
Goals: Dempsey 72.
FH Hafnarfjordur: Larusson, Saevarsson, Sverrir Gardarsson, Nielsen, Bjarnason, Stefansson (Armann Smari Bjornsson 76), Jonas Grani Gardarsson (Asgeirsson 67), Bett, Borgvardt, Gudjonsson (Vitarsson 80), Hallfredsson.
Subs Not Used: Halldorsson, Leifsson, Karkov, Olafsson.
Goals: Armann Smari Bjornsson 83, Nielsen 90.
Referee: Attila Hanacsek (Hungary)