side stitches are a result of a spasm of your diaphragm. This explains why you can breath your way out of them. They are usually a result of taking short, shallow breaths for extended periods of time. If you are able to stay focused enough on your breathing so as to inhale through your nose deeply (even when winded) and take deeper breaths and blow off the carbon dioxide more forcefully, you can avoid these.
These are not the result of an electrolyte imbalance. I'm sure if you were doing a A+B=C theory, then you could say that that improper hydration leads to getting winded and gasping for air thus bringing on the shallow breathing and the side pains.