Cape Town - Jason Roy's bizarre dismissal turned the second Twenty20 international's South Africa's way as the Proteas won by just three runs at Taunton on Friday.
The narrow victory at Somerset's headquarters saw South Africa level the three-match series at 1-1 as bounced back from a nine-wicket defeat by England at Southampton two days earlier to set-up a winner-takes-all clash in Cardiff on Sunday.
England were on course for an unbeatable 2-0 lead while Roy (67) and Jonny Bairstow (47) shared a second-wicket stand of 110.
But when Roy was given out obstructing the field - the first time this had happened in a T20 international - the innings fell away.
England's cause was not helped by batting second under increasingly dark skies in a match that started at 1600 GMT despite a lack of floodlights on the ground, although home skipper Eoin Morgan did field first after winning the toss.
A target of 12 off the last over became four off the last ball after Liam Dawson hit Andile Phehlukwayo for a boundary.
But he could not repeat the trick and South Africa had a morale-boosting victory to follow their first-round exit at the 50-over Champions Trophy, with this win achieved despite the absence of coach Russell Domingo, who had flown home after his mother was involved in a traffic accident.
Durban-born Roy, dropped from England's Champions Trophy semi-final loss to Pakistan after a run of low scores, was in superb form.
He struck nine fours and went to his fifty with a six against spinner Tabraiz Shamsi.
Bairstow fell first, chipping man-of-the-match Chris Morris (two for 18) to mid-on.
And then came the turning point.
Roy veered dramatically off a straight course, with the result he placed himself between the incoming throw from Phehlukwayo, which hit him on the heel, and the stumps.
South Africa appealed and, after on-field umpires Rob Bailey and Michael Gough referred the decision, Roy was given out by TV umpire Tim Robinson, the former England opening batsman.-
Roy was clearly aghast but Morgan insisted it had been a "50-50 call".
"Everyone in the changing room thought it could go either way, so it's not massively controversial," Morgan told reporters.
"You can see why the umpires gave him out."
But England all-rounder Ben Stokes, who was given out obstructing the field in a one-day international against Australia at Lord's two years ago when he reacted to a shy at the stumps from bowler, Mitchell Starc by sticking out a glove, was unimpressed.
"Can't believe that @JasonRoy20 was given out in that manner today," Stokes, rested from this match, tweeted before continuing "embarrassment is the only word that can be associated with the decision."
South Africa captain AB de Villiers, insisted, however: "We were in the right to ask the question of the umpires.
"It's not an easy decision and it's never nice to get out like that."
England still had batting to come after Roy's exit.
But Somerset 'old boy' Jos Buttler, now at Lancashire, was yorked by Phehlukwayo for 10 and Morgan (six) was well caught in the gloom by de Villiers.
England, who had been 133 for two at the start of the 16th over, lost four wickets for 34 runs before finishing on 171 for six.
Earlier, Cape Town-born Tom Curran, a Surrey team-mate of Roy, marked his England debut with an impressive three for 33 in his maximum allowed four overs.
South Africa's total of 174 for eight, de Villiers' top-scoring with 46, was a significant improvement on Wednesday's 142 for three.
Curran, the son of the late former Zimbabwe international Kevin Curran, struck with just his second ball in international cricket when Reeza Hendricks bottom-edged a pull into his stumps.
But fellow opener Jon-Jon Smuts made a brisk 45 with star batsman de Villiers, as he so often does, upping the tempo further with three sixes in his 20-ball innings.
They included an extraordinary sweep off one knee against left-arm paceman David Willey that flew into the River Tone before he was dismissed next ball.
Curran had Morris caught off a slower ball and the 22-year-old then bowled Phehlukwayo for a golden duck with an excellent yorker.
But Farhaan Behardien's 32 proved highly useful.