The belief that nervous shock can cause you to go grey overnight (medically termed canities subita) is one of those tales which could nearly be true. There are certainly cases in medical literature of rapid greying over quite short periods of time. And reported cases go back to antiquity including such legendary figures as Thomas More and Marie Antoinette.
The biology of the phenomenon suggests that a mixture of hormones and cognitive bias is responsible for the myth.
There is little doubt that plausible biological mechanisms exist to account for emotional stress potentially affecting hair growth. What's fascinating to me, as a pain specialist, is that several of the signalling proteins involved (such as nerve growth factor and substance P) are the very same ones that operate in other nerves to create and regulate pain signals.
Human hair cycles between a growth phase (anagen), a resting phase (catagen) and a dormant phase (telogen). Pigment is produced by the hair follicle to colour the hair during the anagen phase while it is growing.
The length of the anagen phase varies according to your genes and certain hormonal levels. It can be anything between two years and eight years. When the follicle receives orders to end the anagen phase, it stops producing more hair and begins to prepare for telogen. Telogen phase lasts for between six and eighteen months at a time before heading back into anagen.
After ten or so of these cycles the follicle runs out of pigment and produces a hair with no colour at all. Despite its white colour, we insist on referring to these as "grey hairs" for some obscure linguistic reason.
Intense stress can cause large numbers of your follicles to hit telogen at around the same time, producing simultaneous loss of a large percentage of coloured hair. This phenomenon is known as telogen effluvium.
Telogen effluvium is often caused by drugs which affect the hormonal control of the hair cycle, including chemotherapy drugs and anti-Parkinson's drugs.
Interestingly, these hormonal signals have a less potent effect on non-coloured hair, so a person could conceivably lose large amounts of coloured hair, leaving behind mostly white hair. This could also happen at a stressful time, such as the night before your execution. It can also happen due to auto-immunity (alopecia areata) where the feral antibodies target pigment-producing follicles ahead of non-pigmented ones.
The problem for the myth is that none of this can happen as suddenly as overnight.
There are also plenty of good alternative explanations for these reports. In the case of Marie Antoinette, she was seen little in public in the couple of weeks before her execution, and would also have been deprived of her wigs and servants to dye her hair, if indeed that was one of her guilty secrets.
People such as President Obama, who go visibly greyer during a period of extreme stress over months or years, are usually at an age where many of their unfortunate follicles are on their last pigment cycle.
Confirmation bias means we remember those stressed people who look much greyer, but don't remember those who go through such periods without visible greying.
We also tend to ignore those who grey early and don't seem particularly stressed. That gets put down to genetics rather than stress.
So no matter how stressful your life may become, it might help to know that although you may achieve your pigmentary potential a little ahead of schedule, you can't go grey overnight.