Iran scored twice after the eighth minute of stoppage time to snatch a stunning 2-0 win over Wales that breathed new life into their World Cup campaign and left their opponents 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 unrecognisable 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.
After a tight first half the match sprang to life after the break.
The second half began with the most extraordinary treble miss as Sardar Azmoun raced through only to strike the post, Ali Gholizadeh curled the follow-up against the other post, and Azmoun headed that rebound straight at Wales keeper Hennessey.
Hennessey rode to Wales's rescue again in the 70th minute, tipping Saeid Ezatolahi's low shot from distance around the post with his fingertips, 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 card felt inevitable. Wales became even less of a threat as Hennessey was sent off.
The goals then arrived extraordinarily late with Cheshmi hammering home a thunderbolt of a shot in a gut punch for Wales, before Rezaeian lifted the ball delicately over the keeper to finish off Rob Page's side.
Carlos Queiroz speaking post-match: "It's just the beginning now, we need to finish the job. I think it was a wonderful day for us."
He added: "I want to say thank you to our players, they were brilliant. They deserve all the attention and respect."
Gareth Bale speaking to the BBC: "It's gutting. We're gutted, there's no other way to say it. We fought until the last second … it's difficult to take.
"We have to pick ourselves up straight away. It's going to be difficult but we've got one game left."
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 US 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.