AEK Athens grabbed two goals in the final few minutes to condemn Hearts to a 2-1 defeat at Murrayfield in the UEFA Champions League third round qualifying first leg tie.
Hearts looked on course for a famous victory after Saulius Mikoliunas had given them an unlikely lead just after the hour.
However, they were reduced to ten-men soon after when Bruno Aguiar picked up a second yellow and from that moment on Hearts were always on the back foot.
Hearts had withstood mass pressure throughout the 90 minutes - but they looked as if they would hang on - until the final minute when Pantelis Kapetanos headed home.
That looked to be it, but in injury time the Greeks broke and Christophe Berra was helpless to prevent himself from deflecting a Nikos Liberopoulos past Gordon.
AEK had dominated the opening 45 minutes and almost took an early lead through Liberopoulos but he crashed a header against the bar.
Liberopoulos again came close, before a rare Hearts counter saw Mikoliunas hit a deflected shot, which almost went in but it hit the outside of Stefano Sorrentino's post.
Hearts were thankful to goalkeeper Craig Gordon as he pulled off a series of great saves to keep the Greeks at bay.
Michal Pospisil almost put through his own net, but he was more than relieved to see his header from Julio Cesar's corner deflect wide of the post.
Into the second half AEK still looked dangerous, but Hearts were much more competitive and began to get a grasp on the game.
Then, although still very much against the run of play, Hearts worked an opening and took the lead.
Edgaras Jankauskas had been introduced as a substitute just moments earlier but his break was crucial as he centred the ball for Roman Bednar - the Czech's snap-shot deflected off the post but Mikoliunas was there to fire home and send the near 40,000 crowd into raptures.
Hearts coach Valdas Ivanauskas was pleading for calm from the sidelines so the last thing he would have welcomed was the red card that soon followed for Portuguese midfielder Bruno Aguiar.
The former Benfica man can consider himself harshly done by, however, as he was perceived to have kicked the ball away and was handed a second yellow by Danish referee Nicolai Vollquartz - which left Hearts with ten-men for the last 25 minutes.
Predictably AEK pushed on, but Hearts defended brilliantly marshalled by captain Steven Pressley and they looked destined for a famours victory.
However, in the last minute of normal time AEK claimed the equaliser which they did deserve.
It came from the left as Stavros Tziortziopoulos crossed into the box and he found Pantelis Kapetanos whose looping header gave Gordon no chance.
Then just moments later AEK broke again and grabbed the winner with almost the last kick of the match. It came through the ever dangerous Liberopoulos as he struck an effort which was flying well wide, but it deflected off Berra and past Gordon.
Hearts now face a momentous task as they need to go to the Greek capital knowing they need to win and score at least two goals to have any chance of staying in the Champions League.