Thembinkosi Lorch scored five minutes from time to hand South Africa an upset 1-0 win and knock holders Egypt out of the Africa Cup of Nations as the shock results at the competition continued on Saturday.
South Africa, who had lost two of their three group games yet crept into the knockout stages, showed great improvement and were the more enterprising team, leaving 70,000 partisan fans at the Cairo International Stadium stunned.
Lorch finished off a sweeping counter-attack as South Africa, who created much the better chances, finally reaped a reward for their efforts.
They will now meet Nigeria, who earlier on Saturday eliminated holders Cameroon in a come-from-behind victory, in Wednesday's quarterfinal.
South Africa's victory followed Friday's shock success for tiny Benin over heavily fancied Morocco at the start of the knockout phase.
South Africa's quick passing moves and counter-attacking looked to catch Egypt off guard in the beginning of the game and, as the match went on, the hosts were increasingly pegged back.
Egypt goalkeeper Mohamed El Shennawi made a spectacular fingertip save to deny Percy Tau's dipping freekick after 24 minutes and was busy throughout the first half as several efforts from the underdogs whistled past his goal.
Egypt's only chance fell to Mahmoud Trezeguet who hit the ball straight at the goalkeeper after being fed a pass by Mohamed Salah, who looked out of sorts in the match.
Salah teed up his team mate again in the 57th minute but once more Trezeguet hit it straight into the arms of South Africa goalkeeper Ronwen Williams.
That was as much as a subdued Egypt threatened in a lacklustre showing.
Captain Thulani Hlatshwayo should have put South Africa ahead after 70 minutes but flashed his header wide, followed 120 seconds later by a shot from Lorch that El Shennawi saved.
Defeat will come as a hefty blow to Egypt who stepped in as emergency hosts in January after Cameroon were stripped of the right to host the 2019 finals. Ironically Egypt were chosen over South Africa.