Convert a Gmail account from POP to IMAP and keep folder structure?
Setup a new IMAP account in Thunderbird then simply drag&drop your folders from the POP3 account into the IMAP account.
You can export your email messages from Thunderbird to an IMAP account preserving the folder structure and avoiding duplicates using MsgExtract.
MsgExtract verifies if the message exist at the target folder prior to uploading it.
You can also suppress the top most folders when replicating the folder structure:
http://docs.maildev.com/article/35-how-can-i-suppress-the-top-folders-when-exporting-email-messages-to-some-target
(Disclaimer, I am the author of MsgExtract)