Toe cramps are terrible. When I get them I find the only answer is to get out of bed and actually stand up on that cramp foot. This will correct the immediate problem. Long term, it's usually a sodium/potassium imbalance. Try eating a banana (for potassium) or something salty (for sodium) in the evening before going to bed. See which one helps or makes it worse. Then you will know what you need more of or less of in your diet.