According to gurus Mitchell Moffit and Greg Brown, those awesome early morning boners are a normal part of the sleep cycle that alternates over the night between REM (Rapid Eye Movement or "dream sleep") and non-REM sleep. When you dream, the brain shuts down production of certain neurotransmitters. One of the neurotransmitters, norepinephrine, also controls vascular blood flow.
According to Moffit, norepinephrine is "like a stop sign to blood flow" that inhibits penile erection. When you enter into REM stage, decrease in levels of norepinephrine dilates blood vessels and increases blood flow, and the result, awesome midnight stiffs that create "bedsheet tent-pitches." We tend to notice an erection in the morning because most of us wake up in the middle of a REM sleep cycle.
Regular cycles of erection as we alternate between REM and non-REM sleep over the night helps to keep the penis oxygenated and maintain health of its tissues. Early morning erections also help to keep grown men from bedwetting. A stiff while asleep makes emptying the bladder literally an uphill task. This explains why we tend to lose the erection as soon as we pee early in the morning. It also explains why men usually do not pee in their partners while having sex.
The scientific explanation sounds convincing. However, you may want to sample alternative views.
MynameisBlarney commenting on The Daily Dot
thinks "Morning wood is caused by the Devil."
Lasciviouslass agrees with him and suggests, "Then ye must be purged."
MynameisBlarney: "PURGE ME! FOR I HATH DONE SINNEDED!"