Proper "using" of ghosts would require a certain degree of control over their behavior and spawning, all the tools we really have available is vague knowledge about their habits. I guess you could try to weaponize them by killing dwarves near the main entrance until you get a violent, stationary ghost (Assuming violent ghosts can be stationary.) to murder everyone that gets too close. But I'm not sure if violent ghosts are aggressive to invaders or just the fortress inhabitants, another issue would be effectively sealing off the "defender" from the rest of the fort when they can pass through walls.
Aside from weaponizing, all I can think of is the previously mentioned glitch where a dwarf that has a labor active at the moment of death continues to perform the labor on repeat until you exorcise them. I imagine they can only repeat labors that don't require any equipment to perform, so mining and crafting are probably out of the question. Maybe endless clay-gathering and fishing are possible? Then there's the possibilities of poltergeist workers, since I'm pretty sure poltergeists can grab items and possibly negate the issue with ghostly miners. In any case, the !!science!! required for this kind of thing would bury most forts in tantrum-spirals before much could be accomplished.