Cruising at 125-1 in pursuit of 175 to win, the quickfire departures of Jonny Bairstow and then, in controversial fashion, Jason Roy brought the visitors back into the game.
Roy is also the third English cricketer to be dismissed in this that after Len Hutton (Test, 1951) and Ben Stokes (ODI, 2015).
Smuts was eventually sent on his way for 45, top edging a Dawson full toss to Plunkett at short fine leg, but de Villiers began to show off his trademark exuberance with some inventive strokeplay, including one huge six behind square on the leg side off David Willey.
Surrey seamer Tom Curran took three wickets on his England debut, but South Africa's Chris Morris was named man of the match for his decisive four-over spell of two for 18. South Africa appealed for Roy obstructing the field, and the third umpire agreed with the Proteas that Roy deliberately ran in the path of the ball.
Roy then quickly changed direction and started to run towards the non striker's end.
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 needed 12 from the final over but Phehlukwayo, bowling yorker length outside the off stump, restricted England to singles off the first three balls and debutant Livingstone was run out after confusion over a second run. But England skipper Eoin Morgan raised a few eyebrows when he suggested the "spirit of the game is open to interpretation" - and there is no doubt what happened in the closing stages on Friday night provides extra spice to the finale.
In keeping with a contest between two sides that are a blend of first-teamers and fringe players - cricket's contractual obligations have long since trumped the out-dated notion that global sport must always be best versus the best - England are likely to give debuts to Dawid Malan and Craig Overton, making it five new caps in the space of three matches. It did not cost us the game, we still had enough firepower to win it. It's a hard one and we've been in those circumstances where it's been a bit more black and white, but today I thought it was 50-50.
"We were going really well for much of the chase but we lost a wicket at a crucial moment and nobody was able to take it up after that", Morgan said.
"Tom [Curran] was excellent - he's put on a yard of pace, which makes his slower balls more effective, and I thought he was very impressive today".
He added: "I was backing my skills and I knew when I got my chance I would be ready".
Asked if those were the darkest conditions he had played in, Morgan replied: "By a country mile".