Many "headache remedies" on the market (in the US, at least) have around 500mg of caffeine (I think that's how much they put in each Excedrin tablet)... Apparently, caffeine withdrawls are one of the MOST common causes of headache in the US.
Personally, when I get a headache I have a tea or espresso. If that doesn't work, then I get out the painkillers.