My fort had a lot of trouble with a necromancer siege where (I think) the necromancers kept reviving parts of each other. A minotaur decided to invade while I was still figuring out how to deal with this, and I also had made some mistakes with how my burrows were set up so I had a lot of dwarfs messing around not doing anything while random people were getting killed. Also I had some vampires which I hadn't had time to deal with during this. I was starting to think my fortress was doomed.
Then things started to go my way.
1) The necromancers (and random parts of the necromancers) seemed to stop coming back to life. I guess a hidden necromancer either died or left.
2) Realized that my stockpiles 1 Z-level down were not part of my burrow, I fixed that and my fortress started operating again.
3) I FINALLY managed to lure the minotaur onto my dodge/pit trap, and he exploded on impact with the floor of the pit.
4) With the immediate danger gone, I let my dwarfs leave the burrows and started mass production of coffins to house the dead. These coffins filled up fast, but I think mostly everyone is properly buried.
5) Figured out who my three vampires were, and built levers in small rooms for them to pull. Then I sealed them up with walls. Their screams of anguish and hunger will keep my dwarf noblemen entertained for years.
6) Grabbed a bunch of dwarfs and assigned them to the military to replace all my dead ones. Hopefully they'll figure out how to train a bit.
7) Restarted production of everything.
8 ) Dug down past all the cavern layers until I found magma. Starting digging out a secondary fort for metal workers. Then we can start making armor and weapons.
I'm glad I didn't give up when I thought hope was nearly lost.