I had the same problem last year ... cramps in the legs during a hard effort. This year it was during my last race. The calves were screaming at the top of the last climb. Knowing that this was potential problem, I spent the last week consuming 2 potassium pills per day (99mg each). Unfortunately, this represents only 6% of RDA. I eat very well and have a freshly prepared salad for lunch almost every day.
My working hypothesis is that I'm drinking too much water. I must consume 3 liters of water per day and go the bathroom once per hour on average. Is it possible that I'm simply diluting out the effective concentration of potassium in my blood through drinking soo much water?