You could have a headache due to blood pressure fluctuations.
I believe I've had the same headaches you are complaining about as I've been doing opiates daily for a few years now. I get the headaches more often when mixing stimulants with my opiates. Lying down when getting these headaches helps significantly, however, when getting up it hits me like a hammer on the head which leads me to believe that it has to do with blood pressure.
I highly doubt it's dehydration as opiates/opioids are known to cause fluid retention (with the exception of diaphoresis a.k.a. excessive sweating).