Perhaps Shaw stitched him back together, one optical fibre at a time -- out of the goodness of her god-fearing heart. After all, she has time to kill -- ten years in fact!
Alternatively, perhaps David can self-heal thanks to nano-bots living inside him, as long as his separate parts can be brought into touching proximity (again Shaw's help needed).
Finally, an outlandish theory of David applying 'black goo' to the separation cut (once head is replaced), which then works its magic a different way than with biological material, and simply heals his wound, or better yet, makes him a real boy!