Ireland secured a thrilling triumph in Derry to avenge their previous encounter with the Springboks, who were defeated 17-10 by the Irish side.
The match concluded with Ireland earning a bonus point, a result that allowed South Africa to retain the top position on the southern hemisphere table.
Despite this outcome, the visitors secured a place in the championship decider against France, who had previously defeated Argentina 45-17 later on Saturday.
Hooker Malcolm Marx's try in the 57th minute brought South Africa back into the contest before disciplinary actions forced a dramatic shift in momentum.
Ireland captain Dan Sheehan received a yellow card, while Springbok replacement Marco van Staden was upgraded to red after receiving a caution.
These decisions set up a nail-biting conclusion during the final ten minutes of play.
The Irish side dominated possession and territory throughout much of the opening half, capitalising on South Africa's immense physicality.
In the previous meeting in Derry last year, Ireland endured a nightmarish first half with 12 players on the field as the Springboks controlled the game.
Fuelled by that painful memory, Ireland attacked with real gusto despite Sacha Feinberg-Mngomezulu kicking the opening points for the visitors.
Both conversion attempts by Sam Prendergast in the first half were missed before a penalty inside Irish territory saw Morne van den Berg dot down off a scrum to level the score.
South Africa head coach Rassie Erasmus hosted a watchalong stream from his team's hotel while banned, marking their first back-to-back Test defeats since November 2022.
The Wallabies had narrowly beaten Ireland 33-31 in Sydney earlier this year, though they have since appointed Les Kiss as head coach following Joe Schmidt's departure.
Ireland led at half-time after two tries from Robert Baloucoune and a score by Ronan Kelleher, with Canan Moodie's try disallowed early in the second half.