Bingo, water too - it seems clear none of this is going to effect the reasons you are (involuntarily) flexing your legs at night. But you can combat the condition it's causing.
Bascially, you are using your legs on and off all day, then flexing them very hard at night, ok - overuse. Keep in mind that when muscles are used hard like this your body is crating a highly acidic state. Excess lactic acid build up.
This is where the strong capilary action of hot/cold water immersion comes in - literally forcing your blood vessels to expand (hot) and contract (cold) and pump the excess acids out of your system.
Also, if your cramps and related muscle soreness is high, your body may be sending a message to your brain saying "mobility impaired", and that can lead to an anxiety uptick, exacerbating the whole deal.
I am a devout adherant of the hot tub spa, cycling through multiple hot/cold immersions many times a week - and, I make sure to dunk my noggin in there so it can benefit too, very very relaxing.
Take care Jadebear, so sorry you are being plauged by this stuff.