The hosts were not to be denied, however, as replacement flanker Phil Waugh made a break close to the ruck and his pass found Rogers, who raced 25 metres to score in the corner.
That levelled the score at 18-18 and it was left to Stirling Mortlock to complete a dramatic finish by knocking his sideline conversion in off the left upright.
While Australia will be pleased to have secured an important victory, which keeps their tournament hopes alive, their performance was sub-standard as they struggled at the scrum while their line-out was hardly watertight.
The two sides produced some error-strewn rugby in the first half.
The tone of the game was set from the kick-off when South Africa full-back Percy Montgomery knocked on and the standard of play never recovered in the ensuing 40 minutes.
Australia opened the scoring after 11 minutes when Mortlock landed a simple penalty after Springbok lock Johann Muller was penalised in front of his posts following a darting run by Wallaby scrum-half George Gregan.
South Africa had a chance to level the scores five minutes later but Montgomery missed a simple penalty of his own.
The remainder of the half was marred by wayward kicking by both teams and the South Africans were ultimately punished in freakish circumstances minutes before half-time.
Springbok fly-half Butch James hooked a clearing kick inside his own half and the ball bounced perfectly for Wallaby winger Mark Gerrard, who accepted the ball at high speed to race 55 metres to score.
The Springboks finally registered their first points six minutes after half-time when James slotted an easy penalty after George Smith was penalised for hands in the ruck.
The lead was narrowed further, to 10-6, when James slotted another easy penalty after Wallaby fly-half Stephen Larkham had been penalised.
South Africa finally hit the front in the 55th minute when Gregan knocked on after a scrum and the visitors hacked the ball down field for centre Jaque Fourie to pounce and score. James' conversion gave the Springboks a 13-10 lead.
Gerrard bombed a certain try in the 62nd minute when he failed to collect a rolling ball one metre from the South Africa line but minutes later, Mortlock levelled the scores when he kicked his second penalty.
South Africa regained the lead in the 67th minute when Montgomery scored in the corner after accepting a looped pass from scrum-half Fourie du Preez.
The conversion was missed though, allowing Rogers' late converted try to seal a win for the hosts.