African Nations Cup hosts South Africa ensured their progression to the quarter-finals as Group A winners as Siyabonga Sangweni salvaged a late 2-2 draw with Morocco.
- Related Content
Rachid Taoussi's Morocco crashed out, though, with tournament minnows Cape Verde taking their place in the last eight courtesy of an historic 2-1 win over Angola.
That result meant South Africa would have qualified regardless but Bafana Bafana struggled to respond to Issam El Adoua's opener.
May Mahlungu finally made the Durban crowd sit up and take notice with a fine finish after the break but Abdelilah Hafidi's quick response inspired fear on the South African bench.
Sangweni secured the point needed to tee up a preferable tie in the next round and news of Cape Verde's late winner did not appear to reach the Morocco team in time for them to mount one last raid.
Cape Verde scored twice in the last nine minutes to stun Angola and seal their spot in the quarter-finals.
Cape Verde, playing in the competition for the first time, looked to be heading home as they still trailed to a first-half own goal from captain Nando heading into the closing stages in Port Elizabeth.
However, Fernando Varela's 81st-minute equaliser gave them hope and then during a dramatic finale they snatched an historic victory thanks to substitute Heldon Ramos' stoppage-time finish.
The triumph means Cape Verde, who beat four-time champions Cameroon in the qualifiers, progress in second place in Group A.