Iran scored twice after the eighth minute of stoppage time to snatch a stunning 2-0 win over Wales on Friday that breathed new life into their World Cup campaign and left the Welsh flat on their backs and facing a make-or-break decider against England.
After Wales keeper Wayne Hennessey was sent off in the 87th minute, Iran produced a remarkable finale, with Roozbeh Cheshmi driving home to give them the lead before Ramin Rezaeian added another in the 11th minute of stoppage time.
Iran, who had been facing elimination if they lost, were almost unrecognizable from the side that was thrashed 6-2 by England in their opener, and they were deserved winners even if they left it very late.
Carlos Queiroz's side were twice denied by the woodwork in the second half at Ahmad bin Ali Stadium and made the most of the extra man after Hennessey was given his marching orders following a dreadful head-high challenge on Mehdi Taremi.
The win moves Iran to three points in Group B, two more than Wales, who were held to a 1-1 draw by the United States in their opener, with England and the U.S. facing each other later on Friday.
The group comes to a head next Tuesday, when Wales play their old rivals and Iran face the U.S.
England will be through to the next round with a win over the U.S., while Iran's heroics have left them with all to play for.
The win was another feather in the cap for Asian sides after Saudi Arabia's shock victory over Argentina and Japan's triumph over Germany, as the assault on the traditional soccer powerbases of Europe and South America continues.
Once again, Iran's buildup to the match had been dominated by speculation about how the players would respond to anti-government protests at home and whether they would give the national anthem the silent treatment as they did against England.
This time they sang along, to a backdrop of boos and jeers from the crowd with some fans pictured sobbing in the stands.
Iran's performance also stood in stark contrast to their woeful display in their opening encounter, as they showed far more ambition, attacking adventure and enterprising passing.
"I didn't change -- absolutely nothing, it was the players that adjusted today," said Queiroz. "They only think about playing football with no fear, they expressed themselves. And that's why it worked well."
There was little to shout about in the first half in which Wales's Kieffer Moore had a volley pushed away by keeper Seyed Hossein Hosseini and Iran's Ali Gholizadeh thought he had opened the scoring only to see his effort ruled out for offside.
The second half, however, began with the most extraordinary treble miss as Sardar Azmoun raced through only to strike the post, Gholizadeh curled the follow-up against the other post, and Azmoun headed the rebound straight at Wales keeper Hennessey.
Hennessey rode to Wales's rescue again in the 70th minute, tipping Saeid Ezatolahi's low shot around the post, but he was then given his marching orders to set up a frantic finale.
Hennessey had raced out of his area but was beaten to the ball by Taremi, with the keeper following through and catching him square in the face with his knee.
The referee initially produced a yellow card, but a trip to the VAR monitor swiftly followed and the resulting red felt inevitable.
As the clock ticked into stoppage time, Wales would have been forgiven for thinking they had survived, but Cheshmi had other ideas.
When the ball found its way to him on the edge of the area, he shaped himself and let fly with a thunderbolt into the bottom corner that FIFA clocked at 64kph.
He darted off in a frantic celebration before being caught by team mates and the Iranian substitutes who leapt on top of him.
That strike rocked Wales to the core and left them open for the coup de grace elegantly delivered by Rezaeian.
Taremi cut in from the left and played the ball to Rezaeian in acres of space on the right. He bore down on Wales' substitute keeper Danny Ward before lifting the ball nonchalantly over him into the back of the net.
"Our performance before the red card was not acceptable," said Wales coach Rob Page.
"We hoped it would all come together today, but we were nowhere near the levels we've set and the standards we've set in recent games."