Iran claimed a famous 2-0 victory over 10-man Wales on Friday as Carlos Queiroz's men scored two goals deep into added time to keep their World Cup campaign alive.
The Iran players, who sang the national anthem before kick-off, sent their thousands of supporters at the Ahmad Bin Ali Stadium delirious by beating a European team at a World Cup for the first time.
Wales goalkeeper Wayne Hennessey became the first player to be sent off in the Qatar tournament for clattering into Mehdi Taremi late in the game.
Iran, who had earlier twice struck the woodwork, finally broke the deadlock in the 98th minute through substitute Rouzbeh Cheshmi's powerful drive.
Ramin Rezaeian clipped in a second on the counter-attack three minutes later.
Iran, who would have been eliminated with a defeat, instead climbed to second in Group B behind England, against whom they had lost 6-2 in their opening game.
Wales tumbled to the bottom of the group and will have to defeat neighbours England in their final match next week to have any chance of reaching the knockout phase in their first World Cup since 1958.
The United States take on England later on Friday.
- Wales start brightly -
Wales manager Rob Page elected to start striker Kieffer Moore after his impressive appearance as a substitute against the USA.
The Bournemouth man's flick-on led to an early effort from Neco Williams that flew just over the crossbar.
The Welsh carved out the first clear chance in the 12th minute as Moore stretched to volley Connor Roberts' cross, but goalkeeper Hossein Hosseini was able to parry his effort.
Iran thought they had taken the lead minutes later, although Ali Gholizadeh was clearly offside before he tapped in and the goal was ruled out by VAR.
A cagey game burst into life with a crazy 20-second spell shortly after half-time. Sardar Azmoun sped clear of the Welsh defence but saw his shot come back off the post.
The ball was recycled to Gholizadeh, who cut inside and curled an excellent strike from outside the box, which bounced away off the other upright, with Azmoun's follow-up saved by a floored Hennessey.
Iran suddenly looked like scoring every time they went forward and Ethan Ampadu had to make an excellent block to deny Taremi the opening goal.
Wales had Hennessey to thank for staying on level terms with 17 minutes left, as he stretched to tip Saeid Ezatolahi's low shot around the post.
The game opened up in the final minutes as both sides knew they likely needed more than a draw.
Iran were given a huge boost in their push for a winner when Hennessey recklessly charged out of his goal and crashed into Mehdi Taremi in the 86th minute.
Remarkably, Guatemalan referee Mario Escobar only initially booked the 'keeper, but that was corrected after a VAR review and Hennessey was dismissed.
Leicester's Danny Ward took his place and quickly saw Mehdi Torabi's effort fly past his post.
But an emotional day for Iran and their fans was given its crowning moments right at the death when Cheshmi hammered home from the edge of the box and Rezaeian raced clear to clip over Ward.