Thembinkosi Lorch scored on 85 minutes to give South Africa a stunning 1-0 victory over Africa Cup of Nations hosts Egypt after a pulsating last-16 clash in Cairo Saturday.
After three woeful group performances, South Africa were rank outsiders against the record seven-time African champions, whose line-up included Liverpool star Mohamed Salah.
A seesaw struggle was settled when a swift counterattack allowed Lebo Mothiba to send Lorch through and he fired past goalkeeper Mohamed Elshenawy.
The winners were unrecognisable from the team that struggled in the group stage as they displayed sharpness and desire not previously evident.
South Africa will face arch-rivals Nigeria, who eliminated defending champions Cameroon earlier Saturday, in the quarterfinals.
Egypt changed three of the side that defeated Uganda to complete Group A with a 100 percent record, five goals scored and none conceded.
Back came defender Mahmoud Alaa, midfielder Tarek Hamed and forward Marwan Mohsen with Baher Elmohamady, Nabil Donga and Ahmed Hassan dropping to the bench.
South Africa made two changes, both in midfield, from the team that lost to Morocco and squeezed into the second round with the worst record of the best four third-place teams.
In came South African Premiership Player of the Season Lorch and fit-again Dean Furman for Thulani Serero and suspended Themba Zwane.
Bafana Bafana (The Boys) had been woeful in all three Group D matches, barely troubling rival defences, and the public and media slammed the negative tactics of coach Stuart Baxter.
The England-born coach hinted at a more attacking approach and was true to his word as Percy Tau and Lorch had ambitious long-range attempts at goal within three minutes of the kick-off.