The allusion in this phrase is clearly to steam engines which gradually slow and then stop when the fire that powers the boiler is too low to produce steam. The first figurative uses come from the USA in the late 19th century.
"...that made it impossible for me to get in one word to her hundred. I stood it for a little while in hope she would run out of steam or material, but she gathered force as she went.