Thorin was successful in causing Smaug a great deal of agony, but the molten gold was ineffective beyond that. Smaug is obviously capable of dishing out extreme temperature, so why did Thorin believe that he could be killed by it?
This isn't in the books and no explanation is given in the movies. The only answer, I'm afraid, is "Jackson - 'nuff said".
A speculative explanation may be that perhaps Thorin thought he could drown Smaug rather than burn him. Obviously the heat of the dragon meant that he couldn't drown him in water (which would just evaporate), but molten gold should be suficient if you want to drown a dragon. But that's just speculation.