- Address Book: File → Export vCard
- vCard → LDIF converter: download and run locally from the command line
- Thunderbird: Tools → Import... → Address Book → Text file
- Mail: Select all messages → File → Save as... → Raw Message Source format
- Thunderbird: Quit. Move the file exported from Mail to ~/Library/Thunderbird/Profiles/yourprofile.default/Mail/Local Folders/. Start Thunderbird.
Thunderbird does sort threads properly, as long as you sort by Date and not Order Received.
Thunderbird's IMAP handling is much better than Mail 2's, and it also manages to do SSL over SSH without giving a random error.