The Black Caps' skipper was on 76 when he got a faint edge to a ball by leg-spinner Imran Tahir that Quinton de Kock took behind the stumps but South Africa took no action.
That decision could prove fatal to their tournament hopes, with the Proteas now needing a miracle to progress to the semi-finals after just one win from six matches, while New Zealand now top the 10-team table.
Earlier, Martin Guptill, who had been guiding New Zealand towards their target of 242 off a rain-reduced 49 overs with a minimum of fuss, trod on his stumps to spark a mini-collapse.
The batsman, on 35, pulled Andile Phehlukwayo and ended up swivelling, only to lose his balance and clip his leg stump with his foot.
Two overs later New Zealand slipped to 74-3 when Ross Taylor tickled a Chris Morris leg-side delivery and De Kock took the catch behind the stumps. Tom Latham's dismissal left them struggling at 80-4.
Jimmy Neesham (23) steadied the ship with his skipper but when he was out, New Zealand were back in trouble at 137-5.
Colin de Grandhomme came to New Zealand's rescue, batting positively and bringing up his fifty off 39 balls but when he was caught in the deep for 60 by Du Plessis off Lungi Ngidi, Kiwi nerves were jangling again.
Eight were still needed off the final over.
But Mitchell Santner pinched a single and Williamson kept his nerve, bringing up his century with a huge six off the next ball and then a four sealed the victory.
Earlier, Rassie van der Dussen gave South Africa something to bowl at as the Proteas struggled to 241-6 after losing the toss.
Hashim Amla made a sluggish 55 off 83 balls but Van der Dussen's 67 not out came at better than a run a ball.
During his innings, Amla became the fourth South African to reach 8,000 runs in one-day internationals.
He is the second-fastest player (176 innings) from any side to reach the milestone after India's Virat Kohli (175 innings).