Jordan will meet Tajikistan in the Asian Cup quarter-finals after scoring twice in three minutes deep in stoppage time to stun Iraq 3-2 in a thriller on Monday.
Jordan had a man advantage after the 77th-minute dismissal of Aymen Hussein but looked down and out in injury time, only for Yazan Al-Arab to prod in a 95th-minute leveler.
If that was hard to believe, better was to come two minutes later for Jordan when Nizar Al-Rashdan curled in from well outside the box to fire the underdogs into the last eight and spark wild celebrations.
Iraq's heartbroken players were left flat-out on the turf, their dreams of repeating the country's fairytale 2007 Asian Cup title somehow snatched from their grasp.
Jordan's coach Hussein Ammouta agreed with his opposite number that the harsh dismissal of Hussein for a second yellow card, for over-celebrating what he thought was Iraq's winner, changed the game.
"The second half belonged to them, they scored two goals and then had to continue with 10 players," said the Moroccan.
Jordan, who held South Korea 2-2 in the group phase, next face a Tajikistan side who are one of the surprise packages of the competition on their Asian Cup debut.
In Monday's other last-16 game, hosts and holders Qatar face Palestine.
'Turning point'
Jordan are ranked 24 places lower than Iraq but they were the better side in the first half in front of a 36,000 crowd at a raucous Khalifa International Stadium.
After going close on at least two occasions, Jordan deservedly took the lead in the first minute of injury time.
The Iraq defense sloppily presented Yazan Al-Naimat with the ball and he raced towards goal before chipping over a flailing and overworked goalkeeper Jalal Hassan.
Iraq, who defeated pre-tournament favorites Japan 2-1 in the group stage, went on the attack after the break.
The pressure paid off in the 68th minute when defender Saad Natiq nodded down and in from a corner for the equalizer.
Jordan went right up the other end and flashed an effort across goal, before unmarked striker Hussein controlled the ball in the box and lashed in to make it 2-1 in the 76th minute.
It was his sixth goal of the tournament but he was promptly given a second yellow card, having sat on the ground and mimicked what appeared to be eating.
Then came Jordan's quickfire double at the death to leave Iraq reeling.
"Of course the sending-off was the turning point," said Iraq's Spanish coach Jesus Casas.
"I don't understand how a referee can send a player off for celebrating.
"When this happened, we had to make changes and this complicated our task."