Fun facts about bodies, souls, and the life-death boundary in DF (based on DFHack experimentation):
A unit (that is to say, any creature, living or dead) always has a body and a soul. When a creature dies, it is flagged as 'dead', which prevents it from appearing on-screen or doing anything, however, it still exists.
The corpse of a creature is an item, and is in fact only loosely connected to its unit through a reference number. Corpses have body data, but this data is simply copied from the living creature at the time it dies and is not, in fact, the creature's real 'body'. The 'real' body of a creature remains in the place where the creature originally died, albeit invisible and intangible, which is why ghosts appear where the creature originally died, not where the corpse is at the time of their rising.
A ghost is the actual original creature, with the same body and soul, only with a single 'ghostly' flag set (and, interestingly enough, the 'dead' flag switched off), and some new ghostly behaviors added. DFHack can easily flip the 'ghostly' flag on and off with almost no change to creature behavior, except that it cannot attack or be attacked by creatures ('ghostly battering' runs off of a different system than standard combat), can fly, and can move through walls (but only if it is not carrying or wearing anything).
When a creature dies through in-game methods, all of its body parts are immediately flagged as 'missing', although the 'dead' flag can be hacked on and off without removing a creature's body parts. The reason why dead creatures have the description 'his upper body is gone' is due to a quirk in the description system, which only describes the 'bottom-most' break in the body 'tree' that is missing. If his left upper arm is gone, the game doesn't need to also say that his left lower arm, left hand, and each individual finger is also missing. The upper body is the 'base' of the body tree, so when the entire body is gone, the game only describes that the upper body is gone.
All creatures are programmed to die immediately when their last HEAD part is removed/destroyed, or when any part flagged 'LOWERBODY' are removed/destroyed. This is irrelevant to whether or not these parts contain actual vital organs - a creature with NOTHOUGHT, or that stores its brain in its chest, will still die when its HEAD is removed. If you make a custom body part that resembles a head but isn't given the HEAD flag, removing the head will not kill the creature, unless it needs the brain to survive, at which point it will die shortly afterwards due to vital organ failure, generally through suffocation. This is why removing the head of a zombie will kill it instantly, but the intact headless corpse can still be animated (or even resurrected) just fine.
Each creature also has a historical figure entry, which is separate from the creature itself. A unit has a reference to a historical figure, but it is possible, through standard modding, to create a situation in which multiple units share the same historical figure, by creating an interaction that allows resurrection of body parts that are not FIT_FOR_RESURRECTION. This typically results in very buggy behavior, though, such as units with blank names, and can easily cause crashes.
Animation of a corpse (or bodypart) creates a new soul (and historical figure - this is why a zombified body part can actually get a name and title of its own if it scores enough kills), while resurrection implants a copy of the original soul and reconnects the revived creature to its original historical figure. In both cases, a new body is created by copying the data contained in the corpse item. The FIT_FOR_RESURRECTION tag exists in order to prevent the multiple-copies-of-one-soul problem, since every creature must have one and only one UPPERBODY part. As previously stated, modders can get around this, at the cost of bugginess.