- Contain the area with walls as well as you can without getting into sight of the hair, or they'll either flee or join the fight.
- Build a cage trap in each entrance tile (should be out of sight as well, of course).
- Remove all your fighting militia from their squads. With some luck they'll stop fighting and leave.
- If you manage to get all of them to leave the hair would now try to follow and get caught in one of the traps.
- If some dorfs insist on keeping on fighting, they're probably doomed with you as overseer (based on your self described engineering prowess). Wait until they die and make sure to use civilian alert burrows to keep other dorfs from trying to retrieve their socks and bodies (probably in that priority order). Forbid everything (including the corpses) as they die. When the last dorf is dead the hair will again seek living victims and should thus end up in one of the cage traps.
If using magma, you probably don't even need to obsidianize it, as you probably add a sufficiently small amount that it will evaporate.
Another engineering based approach is to use a cave-in to smash the hair if possible, or send it into cage traps on a carefully prepared level below. The cages may catch stunned dorfs who might be possible to save before dying of dehydration, but probably not.