What I've learned is that the mbox format used by Thunderbird is not reliable for long term email storage. If something seems wrong with a mailbox in Thunderbird (e.g. a few lost or corrupted emails), do NOT compact it, or you will lose your email forever.
The alternative storage format, maildir, is in my experience much more reliable. I've used maildir and TUI email clients for 7 years without incidents, the only downside is the steep learning curve. Thunderbird has support for maildir but it's still experimental and I wouldn't advice anyone using Thunderbird+maildir for storing emails long term.