Some great answers have been posted.. I'd like to cover a few things that may not have been mentioned yet..
I seem to recall from organic chem, that onions contain
allyl sulphide which ultimately converts to
syn-ropanethial-S-oxide, a volatile gas (by enzymatic reaction as
hypatia pointed out). So the genus of this plant is quite appropriate
Allium (which includes other aromatics e.g. garlic, scallions, shallots, and leeks).
When this gas dissolves in saline tears that normally bathes your eyes, it forms a mild
sulphuric acid, which as you can imagine, is irritating and painful.

(the ref
hypatia gave, also notes this).. It is making your tears acidic which is not healthy to your eyes. Your body's reaction is to flush out this acid by crying. (you can accelerate this process by flushing your eyes with water). I remember reading (don't recall the publication) tears created from exposure to onions, and those shed with normal emotion, were compared. Those created by emotional release, contained more compounds (body's toxins?) than those generated from onions. The implication is that emotional release of tears is beneficial to (emotional and physical) health, giving all the more reason not to hold them back.
You probably remember from grade school, that molecules will change from liquid to gaseous phase to a greater degree, with an increase in temperature. Similarly, a decrease in temperature will also decrease this phase change. It makes sense then, as you lower the temperature of an onion, less gas will be evolved. Cold air from your refrigerator or freezer condenses the volatile gas back to liquid phase and less reaches your eyes. I think that is why your eyes may feel better when you stick your head in the freezer after chopping onions. There may also be a biological explanation, perhaps the cool air mildly anesthetizes your eyes (speculation: slowing down physiological reactions such as enzyme activity and pain signals to your brain)
For particularly irritating onions, I refrigerate them, prior to use and that helps immensely. Also, keep you head away, rather than directly over your cutting area. Running cold water also condenses the volatile gases by cooling the microenvironment.
