Turkey will meet Germany in the Euro 2008 semi-final after beating Croatia 3-1 on penalties after a dramatic extra-time finale in Vienna.
Ivan Klasnic headed Croatia in front with seconds left - only for Turkey's Semih Senturk to volley the equaliser with the last kick of the game.
Arda Turan, Semih and Hamit Altintop scored in the shoot-out for Turkey.
Luka Modric, Ivan Rakitic missed for Croatia and Turkey keeper Rustu saved the deciding kick from Mladen Petric.
It was astonishing finish to a dreadful game, especially for Turkey keeper Rustu, who made an awful error that looked to have given Crotia victory before his free-kick set up Semih for the leveller as referee Roberto Rosetti prepared to blow the final whistle.
Croatia coach Slaven Bilic, who had celebrated what he thought was a famous victory with his players only seconds earlier, could not lift his deflated players and they looked a beaten side even before the penalty shoot-out.
Turkey, in contrast grasped the lifeline and Euro 2008's great survivors and late show specialists were through again, having led matches for only nine minutes in the entire tournament.
They face a huge task against Germany, however, after losing Arda, Tuncay Sanli and Emre Asik to suspensions after they were given yellow cards - and with keeper Volkan Demirel already out in similar circumstance.
But Fatih Terim's side must believe destiny is on their side after another remarkable escape act to follow their last-minute win against the Czech Republic that put them in the last eight.
Turkey recalled 35-year-old veteran Rustu in goal in place of the banned Volkan - and it was more a case of rusty in the first 45 minutes as he produced an uncertain display that spread uncertainty through his defence.
They had a remarkable escape in the 18th minute when Spurs' new midfield man Modric carved out a simple chance for Ivica Olic, only for the striker to somehow rattle the bar from six yards out.
Niko Kranjcar headed the rebound over the top with the entire Croatian bench, led by coach Bilic, already starting to celebrate.
Turkey, hit by injuries and suspension, were struggling to achieve any cohesion, but Mehmet Topal almost stunned Croatia keeper Stipe Pletikosa with a rising 35-yard shot that flew inches wide.
Olic was involved again as Croatia threatened to turn their superiority into a lead five minutes after the interval, when he headed the ball over the on-rushing Rustu - and was then presented with a second chance by Emre Asik but was able to find the target.
Turkey were providing stubborn resistance, but Croatia were also guilty of wasting chances when they presented themselves.
Olic turned creator to tee up Rakitic with 20 minutes left, but he rushed his finish and shot wildly over the top.
Rustu conjured up some of his old magic after 83 minutes as he dived high to his left to turn away a Darijo Srna free-kick that was destined for the top corner.
Modric was easily the game's most creative performer and with just a minute to go in normal time he set up Olic, but Rustu was perfectly placed to block.
Olic had endured a wayward night in front of goal, and he was off target again with the final kick before the game went into extra time.
Turkey actually looked the fresher side in the additional period and Semih flashed an angled shot just over with Pletikosa beaten.
Tuncay was even closer after 111 minutes with a 20-yard shot that was only inches away.
A terrible misjudgement by Rustu appeared to give Croatia victory in the dying seconds of extra time when he inexplicably raced out of his goal to try and tackle Modric - and he was stranded out of his goal as Klasnic headed in his cross.
Croatia's celebrations were wild, with coach Bilic heavily involved, and yet this tournament has told us never to write off Turkey.
And they equalised with literally the final kick of the game when Semih struck a superb finish as Croatia failed to clear a desperate punt into the area by Rustu.
Croatia looked devastated as the penalty shoot-out started, and they got off to the worst possible start when Modric placed his kick wide.
Arda, Semih and Hamit scored convincingly for Turket, but only Srna scored for Croatia with Rakitic missing and Rustu - the most relieved man in the stadium after his late mistake - saving from Petric.
Croatia: Pletikosa, Corluka, Robert Kovac, Simunic, Pranjic, Srna, Modric, Nico Kovac, Rakitic, Kranjcar (Petric 64), Olic (Klasnic 97).
Subs Not Used: Galinovic, Simic, Vejic, Vukojevic, Kalinic, Pokrivac, Knezevic, Leko, Runje.
Goals: Klasnic 119.
Turkey: Rustu, Altintop, Zan, Asik, Balta, Topal (Senturk 76), Sarioglu, Sanli, Turan, Kazim-Richards (Boral 61), Nihat (Karadeniz 117).
Subs Not Used: Zengin, Cetin, Emre, Metin, Gungor, Akman, Erdinc.
Booked: Sanli, Turan, Boral, Asik.
Goals: Senturk 120.
Turkey win 3-1 on penalties
Ref: Roberto Rosetti (Italy).