My neurologist diagnosed it as a cough headache, but he cautioned that nobody knows the root cause.
He did say that it had to be physical/mechanical, in the sense that it had to be some fluid (or lack of fluid) that caused a problem depending on your orientation (bending down) or when shocked (coughing).
He suspected it had to do with spinal fluid and he ordered tests, but they all came back normal. He said that in most patients the symptoms go away after several years, and that's what happened with me.
But reading this article, I wonder if there is some connection here. The headaches started when my second child was born and I wasn't getting much sleep. Maybe, as the article theorizes, lack of sleep caused the fluid in my brain to not drain properly or not be cleaned or something. That could be why sleep decreased the symptoms. Maybe they should study cough headache sufferers and compare against normal people.