Lebanon crashed out of the Asian Cup in cruel circumstances via their disciplinary record despite a dramatic 4-1 win over Group E rivals North Korea.
Hilal Alhelwe hammered home his second and Lebanon's fourth in the eighth minute of stoppage time to move them level with Vietnam on points, goal difference and goals scored in the ranking of the best third-placed teams.
However, an earlier yellow card for Robert Melki gave Lebanon six yellow cards to Vietnam's five, meaning their second appearance at the tournament ends in the group stage, while Mohamad Haidar's late caution after the final whistle took their tally to seven.
Having suffered 2-0 defeats to Qatar and Saudi Arabia, Lebanon needed to win by four goals to guarantee a spot in the last 16. However, their hopes suffered an early blow as a goalkeeping error handed North Korea the lead through Pak Kwang-ryong.
George Melki levelled matters and Alhelwe completed the turnaround before Hassan Maatouk made it three from the penalty spot.
Alhelwe had the final say but it proved in vain with no time left for Lebanon to find the fifth they needed.
Lebanon goalkeeper Mehdi Khalil was left red-faced as he allowed Pak's free-kick to squirm under him in the ninth minute.
A wonderful piece of play from Maatouk saw Lebanon restore parity as he weaved his way down the left byline and cut back for Melki to slot home the equaliser.
Alhelwe saw a header cleared off the line by Sim Hyon-jin but was not to be denied in the 65th minute, brilliantly volleying in Haidar's fine-left wing cross.
Ri Hyok-chol went agonisingly close to levelling for North Korea but Maatouk's confident penalty put the game beyond doubt after Kim Chol-bom felled Rabin Ataya.
Ri Un-chol was thwarted as Khalil atoned for his earlier error, before a chaotic finish saw Ataya denied by Ri Myong-guk and Joan Oumari spurn a glorious chance.
Alhelwe made no such mistake, doubling his tally with a fierce strike but that proved the last kick of the game, and Haidar was booked before slumping to the ground in tears after he and his team-mates missed out by the narrowest of margins.