Sorry to hear that. Been there with a previous vehicle though and know it REALLY sucks hard.
I'd imagine the dead battery activated the alarm. As far as your alarm problems I would try to get as much info from the system as I could. What I mean is that there should be a control box of sorts under your dash or hood that should give a make and model number. Give that the ol google treatment and see if you cant pull up an online manual. If all else fails, see how it is tied critically into the ignition and yank the sob out (unless of course you want to keep it 0.o).
Back to your main problem, I may be mistaken but I believe that the rear lights also have their own relay/fuse system independent from the headlights. Once you get power back you might want to double check for it.
From ZJ to TJ.