I'm a bit loathe to post this in case it jinxes things, but I've been treated for vitamin D deficiency for 7 weeks now and have been headache free. The longest for about 5 years by a long way.
I'm a silly bugger because when my sister got diagnosed with vitamin d deficiency with similar joint pains to the ones I'd been getting I just bought the supplements and took them (I work in nutrition so know the correct amounts) and didn't bother my doctor with asking for a test as I just thought it was pretty unlikely.
So anyhow vitamin d deficiency is pretty common, easy to treat and there is some literature on links with migraines so it well worth getting checked out.