David Miller's maiden ODI century was overshadowed as Andre Russell blasted West Indies to an unlikely consolation win over South Africa.
Andre Russell was the hero as West Indies salvaged some pride from their one-day international series with South Africa by claiming a thrilling one-wicket win in Port Elizabeth on Sunday.
The tourists headed into the fourth match of five facing the prospect of being whitewashed after three successive heavy defeats.
Yet Russell produced some stunning late hitting to ensure his side ended their losing run, striking three sixes in eight balls at the end of the innings to finish unbeaten on 64 from 40 deliveries.
Another win for South Africa, who rested Hashim Amla, Dale Steyn, Vernon Philander and Imran Tahir, appeared inevitable when the Windies slumped to 73-5 in pursuit of 263.
Marlon Samuels (68) and Darren Sammy (51) got the run-chase back on track with a partnership of 93, but another flurry of wickets followed and Russell - after overturning a decision to give him out caught behind at the end of the 47th over - was left to complete the job in the company of last man Sheldon Cottrell (1 not out).
Russell's match-winning knock overshadowed a maiden ODI hundred for David Miller, which enabled South Africa to recover from 32-3 to post a challenging target of 262-8.
Miller accelerated rapidly after reaching three figures to finish unbeaten on 130 from 133 deliveries, but his admirable efforts ultimately proved in vain.
Cottrell (2-39 from six overs) accounted for South Africa's new opening pair of Rilee Rossouw (4) and Morne van Wyk (18) after the hosts had been invited to bat, while Faf du Plessis (4) and AB de Villiers (19) also fell cheaply.
However, Miller found a willing ally in JP Duminy (43) and the duo patiently rebuilt, sharing 90 in 22 overs.
Jason Holder (4-53 off 10 overs) claimed three late wickets after Duminy had been caught and bowled by Sammy, but Miller provided welcome momentum for South Africa, his last 30 runs coming off just 11 deliveries.
That looked to have knocked the stuffing out of the Windies as they faltered badly in reply, five of their top six failing to make it to 20.
Samuels and Sammy counter-attacked impressively, however - both men striking five fours and two sixes apiece to keep the required run-rate in check.
Another twist in the tale followed as South Africa hit back to leave West Indies eight down with 45 still required.
Carlos Brathwaite then became the third Windies player to be run out, De Villiers atoning for a drop in the previous over with an athletic piece of fielding, but Russell refused to give in.
After successfully reviewing a caught-behind decision that went against him on 40, the all-rounder thumped Aaron Phangiso for two sixes over long-on before finishing the job with another huge maximum down the ground off Kyle Abbott.