Recovering emails from defunct IMAP account

My solution at the end: I wrote a tool to convert the .emlx and .partial.emlx files to .eml files. I re-imported these .eml files into Mail.app and was able to upload them to my new IMAP mail account.

In case anyone should encounter the same challenge, here’s my converter (Node.js-based):

https://github.com/qqilihq/partial-emlx-converter