|MadSci Network: Astronomy|
You're right. If the sun went out, the Earth would freeze over very quickly. However, human technology (warm clothes, houses, and burning things for heat) would probably keep many of us alive long enough to starve to death.
The Sun warms the Earth's atmosphere by about 15 degrees C per day. That amount is offset by infrared radiation, which cools the planet by the same amount. If the sun were to turn off, the cooling would continue, and the atmosphere would drop to freezing in just a few days.
However, the warm water of the oceans represents a very large storage of heat. As the atmosphere cools, the oceans would give up this heat. My calculations suggest it would take about three months for the oceans to begin to freeze.
In the meantime, the air over the oceans would be much warmer than the air over the land (since the oceans are giving up heat, but the land isn't). This means it would be warmer if you lived on a coast, but the temperature difference will create violent superstorms there.
Humanity has a few months' worth of oil and gas in storage: assuming the horrible weather prevented oil transportation, we could probably keep warm for a few months before freezing to death. Our reserves of food vary wildly depending on the country, but we generally keep more food around than fuel (because you can only harvest grain for a short time every year). So we're more likely to freeze to death than starve. The United States, with its large reserves of oil and food, its effective transportation system, and its temperate climate (most houses have heating systems), would probably last longer than most. However, billions worldwide would probably die in the first couple of weeks.
Good thing this will never happen!
Try the links in the MadSci Library for more information on Astronomy.