England flirted with an improbable defeat against rejuvenated South Africa before bad light ensured the second Test ended in a draw six overs after tea on day five.
The tourists, 1-0 up in the four-Test series, slipped to 116-6 before Jonny Bairstow (30no) and Moeen Ali (10no) steadied the ship by improving the score to 159-6 off 65 overs - a lead of 161.
South Africa, who have not won a Test match for 12 months, must now play the rest of the series under a new captain after Hashim Amla surprisingly stepped down with immediate effect at the conclusion of the match.
No team in Test history has ever scored over 600 in their first innings and lost the match, England's biggest reverse coming in 2006 when they lost to Australia at Adelaide despite rattling up 551-6 declared.
Defeat in Cape Town seemed inconceivable for the tourists after amassing 629-6 declared in their first innings but in humid conditions on a pitch finally offering bowlers assistance, South Africa cranked up the pressure - spinner Dane Piedt turning the screw with 3-38.
England, 16-0 overnight after South Africa declared their first innings closed on 627-7, were never likely to set their hosts a victory target after spending 211 overs in the field.
But their bowlers could not relax as the visitors lost four wickets before lunch - captain Alastair Cook (eight) tickling his second ball of the day, a Kagiso Rabada inswinger, down the leg-side.
Fellow opener Alex Hales (five) did not add to his overnight score either as Chris Morris sprung to his right to claim a superb one-handed slip catch - his second brilliant effort of the Test after snaffling Cook with his left hand in the first innings.
With England wobbling, Morne Morkel found Joe Root's outside edge but AB de Villiers' slip catch was in vain - replays showing the seamer had overstepped the front line to hand England's No 4 a life on 17.
The reprieve was short-lived, Root adding just 12 more before Morris - with his first delivery of the morning - found just enough swing to beat the outside edge and remove off-stump in spectacular fashion and reduce England to 55-3.
James Taylor, dismissed for a duck in the first innings, got off the mark straight away with a neat punch for three before taking a painful rap on the gloves from Morris - the ball sliding out of his hand on impact.
As ever, the Nottinghamshire batsman was busy at the crease - in particular against Dane Piedt - advancing to loft the spinner for a straight six.
Piedt momentarily had his revenge as Rabada took a diving catch after Taylor top-edged sweeping on 22 only for the ball to bounce out of his grasp as his elbow hit the turf.
The situation was perfect for Nick Compton to bed in but having eased to 15 he picked out Faf du Plessis at mid-wicket off Piedt's bowling to fall just before the interval.
Even so, a brisk Ben Stokes innings would have quickly thwarted South Africa's hopes. The all-rounder swept Piedt for four but in repeating the shot picked out Morkel on the mid-wicket rope.
The spinner struck in his next over too as Taylor (27) over-balanced a little and gloved a catch to Temba Bavuma at short leg, the second wicket to fall for one run, leaving England 115-6.
England's struggles against slow bowling continued when Dean Elgar dragged Bairstow forward in his first over, Quinton de Kock not quite whipping the bails off in time.
Bairstow cut the next delivery for four to bring up England's 150 - a significant milestone with time ticking down before tea, which came with England 155-6.
The tourists kept the shutters down after the interval, adding four runs in six overs before the players trudged off with the light fading fast.
Our coverage of the third Test between South Africa and England begins at 8am on Thursday 14th January.