Steve Smith scored a beautiful century, but his innings came to an end in agonising fashion at the MCG.