England looked out of the game for much of the chase with Jos Buttler, Phil Salt, Moeen Ali and Jonny Bairstow all caught cheaply to leave them 61-4.
By the end they could easily have won it.
The pendulum swung their way when Proteas seamer Ottneil Baartman bowled five full tosses in the 17th over which cost 21.
That left England, who earlier needed 104 from the last 10 overs and 77 from the last six, requiring just 25 from 18 balls.
But Liam Livingstone was dismissed when he hit a full toss from Kagiso Rabada straight to deep square-leg in the next over, and the South Africa quick only conceded four singles.
Left-armer Marco Jansen kept the pressure on, with England unable to find a boundary in the penultimate over.
Still, with Brook at the crease and just 14 needed, England were right in the game – but it was fitting the decisive moment was a piece of athletic fielding in a match packed with such efforts.
With Brook trying to clear long-off, Proteas captain Markram ran back, leaped and held on to the catch as he sprawled on the turf.
Curran turned down a single in the dying moments, backing himself to clear the ropes, but Markram’s effort was the match-winning moment.
London [UK], : Former cricketer Courtney Winfield-Hill will join the England Women coaching set-up as an assistant coach for the upcoming tour to South Afric
Former cricketer and rugby league player Courtney Winfield-Hill has been named as an assistant coach for England Women’s tour of
Australian-born Courtney Winfield-Hill will join England's coaching team this winter for the tour of South Africa and Women's Ashes down under.Winfield-Hill pla
Sign up to our free sport newsletter for all the latest news on everything from cycling to boxingSign up to our free sport email for all the latest newsSign up