Hi there. These things happen - it must have been pretty chilly with a window open all night but maybe it wasn't much different if it wasn't windy? And it sounds like he has done ok. I have a little oil filled radiator (electric) in the room where the hamsters are, which has a thermostat, so it comes on if the room gets below a certain temperature. However some people wouldn't want an electrical item plugged in over night, and to be honest, a combi boiler would probably cost less to come on in the night for an hour eg - but the difficulty there is it heats the whole house rather than one room and it would be a pain to turn radiators on and off every night.
Main thing is - if you have heat on in the evening until bedtime, the hamster has plenty of bedding to burrow down in and some people insultate the cage base by wrapping cardboard and wadding round it. And then the heating comes on in the morning again.
It's a difficult balance because if people are out working all day they tend not to have the heating on all day either and hamsters can get too cold if there's not heating for long periods whenever they are (although freezing temperatures overnight are a big risk).
He should be fine - just keep an eye on him as Socks Mum says

Is he in your bedroom or a living room?