In reply to Graham Callander:
Yes, I have had this problem for the last fifteen years. It can even get dangerous, for instance, having to crawl and walk backwards off the Cairngorm plateau in winter due to excruciating thigh cramps!
For me it was due to lots of cycling (70miles a week and regular audaxes) and not enough hillwalking. I tried all sorts of solutions, like serious stretching on the top of mountains and even liquid calcium (?), suggested by a hillwalking doctor, and used by athletes for cramps.
The best solution has been very simple. Cycle less and climb hills more. If I climb hills once a month and cycle every day, which is often working life as I commute on a bike, I got thigh cramps. Over a week of climbing hills on holidays, the cramps disappear.
I hope that helps. It drove me mad for years!