David Miller was the hero for Southa Africa as he scored 118 to help his sside chase down 371 after David Warner and Steve Smith hit centuries for Australia.