Water wasnt the problem in your case... but getting hydrated. (aka you drank water, it didnt hydrate you... so you drank more...and more... and more)
You see water is not the best hydrating liquid out there... its the easiest to get obviously and works 99% of the time but when its way too hot weather and you are physically exerting yourself... then you are better off with something that is designed to hydrate better under such strain.
For example gatorade, its not an energy drink... rather its a sport drink, hydrates you better than water but its useless to drink it casually however if you are doing heavy sport(or work) activity in hot weather... its alot better than drinking only water.
This summer i played football once a week... around 2 hours of constant running. Now normally water was fine but when it was incredibly hot, water didnt help... i was thirsty all the time after it first started, even 10 seconds after having a drink (also had a few muscle cramps) . But i decided to try gatorade just to see if it actually is any help... and surprisingly it did, atleast to me.
Not only did i drank less during the activity but i also had more energy to push until the very end.