I have no idea what causes the sharp pains but I can tell you that I experience them. I get the sharp pains periodically, often during times of extreme stress.
I can summize that it might be that a blood vessel is putting pressure on an extremely sensitive nerve that sends sharp pains each time the blood vessel throbs. That's the best I can think of with my usual disclaimer that I have no medical training just lots of personal experience.
It sounds like you have done the right thing. Whenever headaches change its a good idea to see the doctor.
The secret of health for both mind and body is not to mourn for the past, not to worry about the future, or not to anticipate troubles, but to live in the present moment wisely and earnestly. Buddha