The body uses ammonia to buffer out acids when they get at a very high level.
You are experiencing emergency acidosis. There were so many acids coming out that they would have burned your urinary tract membranes, therefore you body buffered them with ammonia as they came out. This is an often missed process, but high alkaline urine pHs actually mean that there is a great deal of acid buffered with ammonia in the urine. Some people can actually smell this (the doctors of old days did this, and even 'tasted' it) and others docs use a chemical called Nesslers to test for the presence of ammonia.