Sometimes, when emotions run especially high, wires just get crossed. Your crying circuts overloaded and the overload jumped over into your laughing circuts.
Physiologically, there is really not much difference between bursting into tears and bursting out into uncontrollable laughter.