But Angelo Davids levelled matters, collecting a grubber by Selvyn Davids to score a converted try and take the lead late in the first half.
Australia hit back, sending the ball through several pairs of hands before Matthew Gonzalez broke free to score under the posts for a 12-7 advantage.
SA had conceded only one try going into the match, but suddenly they had let through two.
The Blitzboks, however, took full advantage when Australia were reduced to six men when Henry Hutchinson was yellow-carded.
They swung the ball down the line and Davids went over for his second try unmarked to level matters at 12-12 at the break.
Selvyn Davids scored a great opportunist effort early in the second half after charging down an attempted kick upfield, picking up the stray ball and charging through for the line. Ronald Brown converted to push the lead to 19-12.
Angelo Davids rounded off a full line movement from a line-out to go over in the right corner and extend the lead to 24-12. He went over three times in the pool matches against Scotland and Malaysia.
SA’s only other Games medals were bronze, achieved in 2002 and in 2010.