This may be 1.) the wrong advice, and /or 2.) too obvious.
I also experience head pounding, caffiene related headachs during the first few days of any fast.
Sometimes, like yourself, they have threatened to derail my efforts. The last few times that this has happened, I have simply taken aspirin. (As much as was needed to overcome the pain.)
Some purists may disagree with this solution, and I have been told at least once that i shouldn't, but it works, and their you have it.