Dig a longish tunnelnthat comes up almost to the surface a little ways from the undead. Build drawbridges in it at both the ends, near your fort and the end near the surface, linked to a lever. Now breach to the surface beyond the outer bridge and have your miner run back into the fort (use a civilian burrow). When the undead come into the tunnel, pull the lever (which you put in a meeting area so there will be dwarves hanging out available to pull it immediately). Now you've got at least some of the undead trapped in the tunnel. leave them there and dig another tunnel, and repeat until you've got them all nicely trapped. It may take a while, but you've got time.