Sunday night was a real rollercoaster, a true showcase for African football, with the evening ending in a dramatic 2-2 draw between Bafana and Morocco - the hosts eventually winning Group A and the North Africans going home as Cape Verde pulled off a surprise 2-1 win over Angola.
Morocco twice led on the night, knowing a win would take them through.
They took the lead when Issam El Adoua headed home 10 minutes in.
Bafana defender May Mahlangu equalised with a superb curled effort on 71 minutes.
But the game turned on its head when Mehdi Namli put Morocco in front again, then up came Siyabonga Sangweni, appearing in a wide-left position, up from the back, cutting inside and curling home a beautiful strike to become a hero and break North African hearts with a late equaliser.
The hosts, who have reached the Nations Cup knock-out stages for the first time since 2002, will play Group B runner-up in Saturday's quarter-final in Durban.
"We feel very, very proud to have achieved our first objective. I must thank the players and the fans," said Bafana Bafana coach Gordon Igesund after the game.
"Morocco were a very tough team. I do not want to point out mistakes, but we conceded two goals we should not have done. There are now two games to the final and I believe in my players."
Government officials and the SA Football Association (SAFA) were quick to praise the side's effort.
"Thank you South Africa for your unwavering support for the national team," sports minister Fikile Mbalula said in a statement.
"You have written a piece of history for yourselves, families and friends," said SAFA president Kirsten Nematandani.
Copyright is owned by Africa Outlook and/or Outlook Publishing. All rights reserved.