Petersen and Van der Dussen, battling a finger injury that has now ruled him out of next month's deciding third Test at the Oval, had batted through Saturday's second session to take World Test Championship leaders South Africa to 141-3 at tea.
But Stokes, who has now won five of his six Tests as full-time captain, ended their 43-over stand while pushing himself hard in a 14-over spell either side of tea as he removed Van der Dussen and Petersen for their interval scores of 41 and 42 respectively.
"It has been incredible," said Stokes, who in addition to his century had match figures of 4-47, at the presentation ceremony.
"To come back from last week's disappointment at Lord's and put in the performance we have this week, it gives us a lot of confidence back and set things up nicely for the last game at the Oval."
Just three balls after tea, Van der Dussen pushed well outside off-stump to a Stokes delivery he might otherwise have left and was caught behind to end a stand of 87 with Petersen.
But there was little Petersen could do other than glove a simple catch to Foakes when Stokes, still operating with the old ball, got a delivery to rear off a length and cut away to end a gutsy 159-ball innings that featured just one four.
South Africa were now 151-5, with all of their specialist batsmen dismissed.
Stokes then gave the new ball to 40-year-old England great James Anderson and recalled seamer Ollie Robinson.
Robinson, in his first Test in seven months, took 4-43 and Anderson 3-30.
Anderson's haul, taken from the end named after him at his Lancashire home ground, saw him surpass Australia's Glenn McGrath as international cricket's most prolific fast bowler across all formats, taking his combined tally to an astounding 951.
"It's been a hard few days -- we had to work really hard on that pitch," Anderson told the BBC.
"Every time I play cricket it could be the last so I just enjoy the experience. We have had a shift in mindsight, I could retire tomorrow and be delighted but I'm not!
"Ollie Robinson bowled brilliantly. He could have had more wickets in the first innings and he got better and better."
South Africa had resumed Saturday on 23-0, having already been dismissed for a meagre 151 in their first innings when Proteas captain Dean Elgar opted to bat in bowler-friendly conditions after selecting a second spinner in Simon Harmer.
The Proteas, however, lost both openers nine overs into Saturday's play.
Elgar fell without addition to his overnight 11 when he was bowled by a full-length delivery from Anderson that sent his off-stump cartwheeling.
South Africa's 33-1 soon became 39-2 when Sarel Erwee, on 25, played neither a leave nor a defensive stroke to edge a delivery from Robinson to Foakes.
"Crazy game. I guess that's what Test cricket is," Elgar told Sky Sports. "England were far better than us to the last three days so I have to give it to them. Cricket is such a funny thing. I think England batted well. The game is small margins at the moment and we're playing against a side that doesn't give you much."