But you must have the original file in ID right? To my knowledge there's no way to import back into ID from EPUB.
First of all, a TOC is not only "The Toc". You need to distinguish between the dynamic Reader TOC and a optional TOC e.g. on page 3. While the first is generally required, the second is optional in most cases.
You must also distinguish whether the export is EPUB 2 or EPUB 3.
1. Assume you mean the dynamic TOC > InDesign will create the TOC on the right place, if you choose the TOC-Style during the export.
2. Assume you mean the TOC on page 3 > Here the content- or article-order is important! If you have a threaded story from page 2-100 and your TOC as a single frame on page 3 > InDesign will first export the content on page 2 AND the content of all threaded frames and at least your TOC on page 3.
3. Assume further your exported file is correct in most cases, you can change the order of your TOC in the EPUB directly in the content.opf file in the spine-area
To give you more help, I must have a look at your file.
Thanks for getting back to me. My solution (for now) was to export the file as an interactive PDF and pay a vendor to convert it to EPUB from there. Not very satisfactory for the long term but a fix for now. I'm wondering whether I should set up the front matter in future books as separate articles and use the articles panel and then export from there. Any advice?
[Personal information removed by moderator]
Usually, you leave the TOC unthreaded.