Lee ripped through the South Africa tail as the Proteas collapsed against the second new ball. At close Australia were 125 for one in their second innings, an overall lead of 227, with two days to play.
Lee finished with five for 69 South Africa were bundled out for 267 shortly before tea, taking his total to 202 wickets in 51 Tests, two more than legendary Australian Jeff Thomson.
"Growing up, you look at guys like Jeff Thomson as heroes, so going past him is pretty special," said Lee.
Jacques Kallis made a patient 114 for South Africa but his dismissal in the second over with the new ball triggered a collapse in which the last five wickets fell for 12 runs in 34 balls.
"It was an important period in the match," said Kallis. "We didn't bat as well as we could have. There were quite a few soft dismissals."
Kallis admitted that South Africa, already 1-0 down in a three-match series, were under pressure to save the game. "But we've got out of situations like this before," he said.
Lee meanwhile revealed that although he grew up hearing about bowlers like Thomson and Dennis Lillee, his boyhood hero was South African fast bowler Allan Donald.
"He was a bloke I thought had the perfect action. I started wearing the white wristband as a kid from watching him. He had that aggression when he needed it but he could also go back to bowling line and length."
South Africa were in a reasonable position midway through the day. With Kallis playing an anchor role, they were in with a chance of matching Australia's first innings total of 369 until the second new ball was taken.
After an over from Lee, Stuart Clark struck with the first ball of the next over when Kallis was caught and bowled for 114, the ball looping back to the bowler off a leading edge as Kallis tried to play to leg.
"It was an important wicket," said Lee. "We knew we were only one wicket away from turning the match around. The way Jacques Kallis batted was brilliant and Stuart getting that wicket started a whole snowball effect.
"We were a little down for a while, not playing to our normal standard, but as soon as that wicket went down we picked up a cog."
Lee ripped through the rest of the batting, taking four wickets for nine runs.
Kallis played an innings of contrasts. He started with a blaze of strokes Saturday, reaching his half-century off 49 balls.
After his overnight partner, AB de Villiers, was out to the 12th ball of the day, Kallis went on the defensive on a pitch of uneven bounce on which run-scoring had been difficult throughout the match. De Villiers and Kallis put on 134 for the third wicket.
Kallis played only four scoring strokes in the first hour, three singles and a pulled four off Clark, as he moved from 72 to 79.
Left-hander Ashwell Prince was more aggressive, making 33 before he was caught at square leg off Shane Warne, dancing down the pitch but mistiming an attempted hit to midwicket.
Kallis reached his 24th Test century and his third against Australia in the last over before lunch when he punched Warne through the covers for his 17th boundary. His second fifty took 124 balls. It was his fourth century in successive Tests at Kingsmead.
He added only ten more runs off 49 balls after lunch before his dismissal.
Shaun Pollock was caught behind seven balls later and Mark Boucher had his leg stump sent flying when he missed a pull shot in Lee's next over. Lee's pace was too much for tailenders Andre Nel and Makhaya Ntini as the South African innings folded. It was Lee's seventh five-wicket haul in Tests.