Ireland produced an outstanding display at Newlands to overcome the first-half dismissal of CJ Stander and claim a historic 26-20 win over South Africa, their first Test victory on Springbok soil.
Joe Schmidt's injury-hit side started brightly on Saturday, but appeared likely to suffer defeat when Stander was sent off in the 23rd minute for a dangerous challenge on Pat Lambie that forced the Springboks fly-half to leave the field on a stretcher, having seemingly been knocked out cold.
South Africa, in Allister Coetzee's first Test in charge, took advantage of their extra man to turn a 10-3 deficit into a 13-10 lead, only for the visitors to fight back superbly.
Conor Murray's try early in the second half - on his 50th Test appearance - put Ireland back in front and they did not relinquish that lead as Paddy Jackson finished with 16 points.
JP Pietersen almost scored in the left corner for South Africa after the final hooter, but the wing was bundled into touch to spark wild celebrations from Ireland.
It was the Springboks who were guilty of ill-discipline early on and, after Lambie had missed an early shot at goal, Jared Payne pounced on a Luke Marshall grubber kick to score the game's opening try, converted by Jackson, and give Ireland a deserved lead.
Lood de Jager was yellow carded for an infringement in the build-up, but the Springboks stayed in touch with a numerical disadvantage, Lambie and Jackson exchanging penalties.
And Ireland then saw their task become much tougher as a leaping Stander clattered Lambie with his hip, after the number 10 had put in a chip over the top, and was sent off following a referral to the television match official.
Elton Jantjies, Lambie's replacement, narrowed the hosts' deficit to four points with a penalty, before supplying a neat inside pass for Lwazi Mvovo to charge over in the 31st minute.
South Africa had a two-man advantage for the remainder of the opening 40, Robbie Henshaw sin-binned for a late and high tackle on Jantjies after the latter had provided the try assist.
Yet a Jackson drop goal ensured the visitors nevertheless went into the break on level terms and Ireland opened up a shock lead early in the second half, following Henshaw's return, as Murray pounced on a loose ball to score.
Having hit the right-hand post with a penalty attempt from long-range on the hour, Jackson made no mistake with a second opportunity and extended Ireland's advantage to 10 points with 12 minutes remaining.
However, Pieter-Steph du Toit provided a much-needed Springboks response to set up a grandstand finale, the replacement forward intercepting a Jackson pass to cross unchallenged for his first international try.
Jackson was narrowly wide with a second drop-goal attempt, but added another penalty before some desperate defence denied Pietersen a try that would have given Jantjies the chance to break Ireland hearts.