Wales goalkeeper Wayne Hennessey went from hero to zero as Iran scored two goals deep into added time to stun Rob Page's side at the World Cup.
Roozbeh Cheshmi and Ramin Rezaeian both netted after the 98-minute mark to secure a deserved 2-0 victory for Iran, to condemn a poor Wales side to defeat and bottom spot in Group B.
Wales were way off their best, but looked like they might ride their luck to escape with a second point of the tournament – before a dramatic finale.
After both teams dropped points in their opening Group B encounters – Iran thrashed by England and Wales holding the USA to a draw – it was vital they got their campaigns into top gear at Ahmad bin Ali Stadium.
Wales brought striker Kieffer Moore into the starting lineup after his star turn off the bench in the second half against the USA. But it was Carlos Queiroz's forwards, inspired by Sardar Azmoun, who dominated.
The Bayer Leverkusen star played a major part in what Iran thought was the opening goal, midway through the first half. Ali Gholizadeh rounded Hennessey and slotted home, but his effort was rightly disallowed for offside.
Wales continued to stutter in the first half, with centre-backs Joe Rodon and Chris Mepham struggling to contain Azmoun and company.
Iran hit the post twice in the space of a few seconds just after the break, first Azmoun racing through and then Gholizadeh curling beautifully around Hennessey – but both efforts struck the upright.
Hennessey then made a vital save to tip Saeid Ezatolahi's shot round the corner, as Wales survived waves of Iranian pressure. But the ex Crystal Palace ‘keeper was shown a straight red after he raced out of his box and clattered into Mehdi Taremi.
The mistake proved costly after two well-taken late goals clinched a dramatic victory for a resurgent Iran, who boosted their qualification hopes.