Fatih Terim's side looked down and out with 62 minutes gone as they trailed to goals from Jan Koller and Jaroslav Plasil. But two uncharacteristic errors from Petr Cech, one of the world's top keepers, allowed the Turks to mount their comeback.
Arda Turan scored at Cech's near post after 75 minutes before Turkey captain Nihat Kahveci equalised with three minutes to play after the keeper fumbled a routine cross.
Nihat swept the ball into the empty net to equalise as several Czech players fell to the ground in despair.
Suddenly, with penalties looking a certainty, another mistake at the back allowed Nihat through and he lashed in the winner from 25 metres off the underside of the bar.
More drama followed when Turkey keeper Volkan Demirel was sent off in stoppage time for an off-the-ball push on Koller.
Midfielder Tuncay Sanli went in goal for the closing stages but Turkey held on to seal a meeting with Croatia in the last eight in Vienna on Friday.
Volkan and Mehmet Aurelio, who picked up his second booking of the tournament, will be suspended though.
"I congratulate my team for their great performance," said Terim. "It rained once again and we had to sweat once again.
"I send my love and greetings home to Turkey. Go out and celebrate, go out on the streets and savour this feeling.
"My players are going to celebrate now too. They deserve it. I said we'll be remembered for this."
The game marked the end of 35-year-old Koller's Czech career and the team's all-time leading scorer looked shattered as he walked off the field for the last time.
Nothing could have been further from his mind when he nodded his side in front in the 34th minute with his 55th goal in his 90th appearance.
A bad miss after 60 minutes, just before the second goal, will haunt him even though Plasil made it 2-0 two minutes later when he swept in a low cross.
Turkey ended with six points in Group A, three ahead of the Czechs, who were eliminated along with co-hosts Switzerland. Portugal, who fielded a reserve side against the Swiss, finished top despite a 2-0 defeat in Basel on Sunday.
Czech coach Karel Brueckner looked every one of his 68 years when he sat in stunned disbelief in front of reporters after his last match in charge before retiring.
"To lose such a game is incredible, even with four minutes to go we were winning 2-1," he said. "To concede two goals in the last three minutes is unbelievable.
"You cannot make mistakes like that and expect to win games. We made mistakes for the second and third goals and did not defend well.
"You can't play like that. In the end we surrendered to Turkey's pressure."
Last Mod: 16 Haziran 2008, 11:44