Let me be more specific:
Their CNS is vastly less centralized than ours. Without a head, they don't get sensory input- so while they can 'live', the are highly unlikely to. Their shelf life is how long it takes for them to consume their fat body (liver) and other bits, aka starve to death, and they may stumble around but have little coordination. It will mostly be an existence of clinging to shit. That is also assuming they don't bleed out haemolymph on the spot from their open circulatory system. You will notice that while their primary abdominal and thoracic ganglia are both larger than the supraoesophogeal ganglion (=brain) they serve different functions and aren't necessarily directly correlateable.
As for vertebrates...
A few cases have been observed of headless chickens doing quite well, like mike