It's not a solution (sorry), but you might try using
Sigil which is a free epub editing tool. I use it to fix TOCs, and find it much better than Calibre.
Once in there you can edit the TOC directly, generate a new one, and even do an overall epub validation (Tools menu). That returns a number of cryptic messages, but it might give you a pointer.