South Africa came from behind twice to draw 2-2 with Morocco Sunday and top Group A in the Africa Cup of Nations.
Bafana Bafana (The Boys) finished on five points with Cape Verde, but a superior goal difference enabled the hosts to stay above the debutants, whose fairy-tale continued with a 2-1 win over Angola in Port Elizabeth.
Issam El Adoua and Abdelilah Hafidi put the Atlas Lions ahead in this Indian Ocean city only for May Mahlangu and Siyabonga Sangweni to equalise and condemn Morocco to a fourth consecutive first round exit.
Morocco made making five changes from the team that came alive only in the closing stages of a midweek 1-1 draw with Cape Verde.
In came Ahmed Kantari, Kamel Chafni, Chahir Belghazouani, Youssef Kaddioui and Youssef El Arabi as coach Rachid Taoussi opted for a five-man midfield and among those axed were wide men Nordin Amrabat and Oussama Assaidi.
South Africa, who made a similar number of alterations after being held by Cape Verde in the tournament opener, gave a vote of confidence to the starting line-up in a 2-0 victory over Angola.
Bafana Bafana were stricken by nerves in the early stages as the Atlas Lions attacked from the kick-off to quieten a sell-out 60,000 crowd at the Moses Mabhida Stadium.
Suspended playmaker Younes Belhanda was not being missed as young Spain-based midfielder Abdelaziz Barrada took control and the home team had several scares before falling behind.
El Adoua rose highest in the heart of the six-yard box to nod in a corner with Khune reacting too slowly as the South African defence was once more exposed at a set piece.
Morocco were comfortably containing the host nation, apart from a Bernard Parker shot from an acute angle that flew across veteran goalkeeper Nadir Lamyaghri but wide of the far post.
Chafni had a glorious chance to double the advantage just before half-time as he sprung an offside trap and broke clear, but Khune raced outside his box, blocked the ball with his legs and cleared it.
Thuso Phala gave the home crowd a rare reason to cheer eight minutes into the second half with a curling free kick over the wall and it took a diving one-hand save from Lamyaghri to keep the ball out.
There have been concerns for some time about the pace and positioning of South Africa centre-backs Sangweni and captain Bongani Khumalo and they were caught napping again on the hour mark.
El Arabi, a highly-effective substitute against Cape Verde, found himself alone with just Khune to beat, but the goalkeeper once again came to the rescue with a one-hand parry that was cleared.
It proved a costly miss as South Africa levelled on 71 minutes with Sangweni bursting into opposition territory and passing to Tokelo Rantie, and his pass was superbly curled into the net by Mahlangu.
In a dramatic finish, South Africa fell behind again when substitue Abdelilah Hafidi fired home on 82 minutes only for defender Sangweni to level four minutes later with a curling shot any striker would have been proud of.