Wallis was on the brink of elimination after two stoppage-time goals gave Iran the victory they deserved.
Wayne Hennessy’s goal led a magical life against a superior Carlos Queiroz side who fired home and had a goal disallowed by VAR.
Then the veteran goalkeeper saw red late on as he ran out of his area and almost defiantly tipped Mehdi Taremi.
But with the ten-man Dragons fully extended, Rosbeh Chesme took advantage of a mistake by Joe Allen to smash home from 20 yards out.
A second soon followed when Razmin Rezaian sealed a quick break with a fine finish.
The Welsh players have been knocked to the ground by the heat and effort but they know their World Cup dream is over.
Just like on Monday against the USA, Wales were the second best team in the first half – even though they had their first big chance.
Keefer Moore stretched his leg to get in from the right end of Conor Roberts’ cross but fired his shot straight at the keeper.
The Bournemouth senior forward has been brought back into the squad after his impressive appearance on Monday, but he hasn’t been given the service he needs to thrive.
The Dragons got away with one when Ali Gholizadeh took advantage of a mistake from Roberts and tied it up with Sardar Azmoun to score.
The VAR came to the rescue when the Charleroi striker drifted into an offside position before shooting the ball away.
There were more escapes after the break as Azmoun raced clear but hit his shot just wide of the post.
The rebound fell to Golizadeh, who drifted before hitting the opposite post with a brilliant 20-yard curler.
Azmon was the first to bounce but incredibly headed for Hennessey.
At the other end, Gareth Bale’s cross fell to Moore’s head but the striker was under pressure and freed his effort onto the surface of the net.
Rob Page dumped Dan James and Brennan Johnson to try and inject new life into Wales just before the hour.
It was a statement of intent from the Chief of Dragons who knew this was the best opportunity to claim victory.
However, they still struggled to create as many clear chances as those at the other end as Saeed Ezzatullah volleyed low around the post with Hennessey’s fingertips.
One good chance at the other end was Hossein Hosseini deflecting a shot from Ben Davies after good work by Moore.
But Hennessy’s reckless tackle to deny Taremi when he exploded clear was upgraded to yellow to red by the Guatemalan referee and left the Dragon hanging on.
Aaron Ramsey was sacrificed to allow Danny Ward to come in and take his place in goal.
Sub Allen’s quick clearance only got to Cheshmi who hit a superb low shot into the corner from 20 yards.
It sparked wild celebrations and there was more two minutes later when they broke down the left side and Rezaian lifted the ball over Ward.
Wales go into their final game with England knowing they need snooker.