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.
But the Blitzboks 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 also went over three times in the pool matches against Scotland and Malaysia.
Apart from the gold in 2014, SA’s only other Games medals have been bronze, in 2002 and again in 2010.