Cape Verde booked their place in the quarter-finals of the African Cup of Nations after beating Angola 2-1 in Port Elizabeth.
Angola took the lead in the 33rd minute of an uninspiring first half when Fernando Neves diverted Amaro’s cross in at the near post.
But two woeful mistakes from Angola goalkeeper Lama turned the game on its head in the last 10 minutes.
First he fumbled an 80th minute corner, allowing Fernando Varela to head home from close range, and then he failed to hold a cross, with Heldon hammering home the loose ball to trigger jubilant scenes on the touchline as Cape Verde joined South Africa in the last eight in what is their first ever finals.
With qualification for the quarter-finals at stake, the tension of the occasion meant that both sides adopted a safety first approach in the first 45 minutes.
Manucho’s header wide off an inswinging Gilberto free-kick was the only genuine incident of note in the first half hour.
Angola had shaded proceedings and it was they who took the lead on 33 minutes.
Djalma Campos played Amaro in down the left and as Neves tried to cut the cross out he succeeded only in diverting it past Vozinha at the near post for an own goal.
Cape Verde reacted well and Julio Tavares should have done better when he rose to head a free-kick inches wide at the back post.
Ryan Mendes then did superbly to keep the ball in play on the left and curled in a cross which Platini headed over the bar.
A forceful run down the left from Babanco resulted in a cross which would have sneaked in at the near post were it not for Lama’s intervention.
Cape Verde were much improved in the second half, knowing that a defeat would have meant elimination from the competition.
Heldon bent the ball over the wall and Lama made a hash of pushing it out in what was a sign of things to come late in the game.
Cape Verde substitute Djaniny spurned a good chance when better control in the area would have allowed him a clear shot on goal
Tavares headed over a fine inswinging free-kick from Marco Soares as Angola were nearly made to pay for more negligent play at the back.
Cape Verde drew level when Lama punched a corner from Heldon back into the danger zone and after a goalmouth scramble, Varela headed home from close range.
The other game between South Africa and Morocco, ultimately finishing 2-2, was a see-saw affair, meaning both of these sides had a realistic chance of qualification.
Until Cape Verde’s equaliser, it looked as though it would be Angola going through, but the smallest nation ever to participate in the African Cup of Nations booked their passage through in the 90th minute.
Lama fumbled a cross from the right and the ball dropped to the impressive Heldon, who drilled his left-footed effort unerringly into the net to ensure his side finished second in Group A.