Dehydration and electrolyte imbalances can trigger headaches... your physician friend seems to have made a pretty solid diagnosis and the coke is loaded with caffeine (a stimulant), loads of sugar, and sodium which is a short term fix.
Bonking, as it relates to cycling and physical activities refers to a state of sedition where your body just refuses to work because of muscle glycogen deficiency where the legs quit but the brain keeps humming, blood glucose deficiency where the brain quits and the legs keep turning, or the full on bonk where everything quits and you will be lucky to not fall off your bicycle.
I like the British version of bonking better.