Achraf Hakimi missed a late chance to equalise from the penalty spot as South Africa shocked 10-man Morocco to set up a quarter-final against Cape Verde at the 2023 Africa Cup of Nations.
Evidence Makgopa produced a neat finish to score the opener in the 57th minute, surviving a lengthy Video Assistant Referee (VAR) check for offside and putting Bafana Bafana on their way to a surprise victory over the 2022 World Cup semi-finalists.
Hakimi was afforded a golden opportunity to level when Mothobi Mvala was adjudged to have handled Ayoub El Kaabi's shot, only to fire his 85th minute spot-kick against the crossbar.
Manchester United midfielder Sofyan Amrabat was dismissed in stoppage time before Teboho Mokoena curled a classy free-kick past Bono to confirm the upset in style.
The 1996 champions will now aim to improve upon their quarter-final exit on their most recent appearance at the finals in 2019, when they take on the unbeaten Blue Sharks on Saturday (20:00 GMT) for a place in the last four.
Morocco are Africa's top-ranked side but will have to wait until they host the 2025 edition of Afcon to end their long wait for a second continental title, which stretches all the way back to 1976.
Atlas Lions left to rue wastefulness
Injuries meant Morocco were shorn of forwards Hakim Ziyech, their match-winner against Zambia, and Sofiane Boufal, and their watching absentees must have wondered how the North Africans conspired to miss so many opportunities against a team ranked 53 places below them.
Amine Adli and Selim Amallah sent excellent chances wide after breaking free inside the box as Morocco's accuracy deserted them during the first half, while South Africa centre-back Mvala intervened twice during the early stages to stop fierce shots from Hakimi and Adli.
Having dealt with a succession of dangerous deliveries during the opening 15 minutes, the underdogs threatened for the first time when Bono descended quickly to turn Mokoena's awkward strike from distance behind.
The effort proved the only attempt on target of the first period, but Morocco should have gone ahead shortly after the restart when Azzedine Ounahi won possession just inside South Africa territory, surged into the penalty area and lofted the ball over the crossbar following a swift one-two with Youssef En-Nesyri.
Makgopa soon punished that profligacy, controlling Themba Zwane's first-time pass to tee himself up inside the penalty area and slot beyond Bono from a tight angle for his first international goal in more than two years.
The forward for South African top-flight club Orlando Pirates looked to have been perilously close to an offside position, but Ismail waved play on following another quick VAR check.
With a fresh Afcon shock on the cards, Morocco almost replied quickly through a stinging Abde Ezzalzouli shot which Ronwen Williams pushed away before Ounahi's shot on the rebound was hurriedly cleared.
Morocco manager Walid Regragui had reacted immediately by sending on Ismael Saibari and Amine Harit for Amallah and Adli, yet his players found themselves struggling to unduly trouble compact opponents in determined defensive mood.
Salvation looked to have arrived for the Atlas Lions when El Kaabi's shot hit Mvala on the arm and the spot-kick was awarded following a pitchside monitor check by Ismail, only for Hakimi to smack his effort against the top of the bar and over.
In a frantic finish, Amrabat was ruled to have been the last defender when he brought down Mokoena inside the box, receiving a straight red card instead of an initial second yellow following a VAR review.
Mokoena then put the contest beyond doubt by curling in beautifully for South Africa's second, continuing a memorable campaign for Hugo Broos' side which has already included their largest ever Afcon win.
Their path to a potential semi-final against Nigeria or Angola is likely to test their defensive resolve again, pitting them against a Cape Verde team who scored seven times in the group stage before beating Mauritania 1-0 in their last-16 match on Monday.