The thermostat was like $15 shipped on Ebay, plus $8 for an extension cord to wire it up. So it was about $23 for the whole setup. The space heater I have isn't huge, it's actually designed for use on desktops. It's basically the size of a desktop pc speaker. Much smaller than a shelf, for sure.
Here's a vid on how to wire up the thermostat. It's actually super easy.