Just for the record, I'm posting this here. It might help other people as well, or myself if I forget exactly how I did it the first time.
I'm using Thunderbird with IMAP quite often. It works quite nicely. However specifying an alternative Trash folder doesn't always work as expected.
For instance on your GMail account Thunderbird will correctly detect that your trash is in
[Gmail]/Trash, but messages put in that Trash are automatically deleted after 30 days. I prefer in general to keep all my old mails in an
Thunderbird has a nice option that ask you in which folder you want deleted items to placed, but that's not exactly what it does. Actually this give it another "Default Trash" folder name, as shown in the
prefs.js (it is stored in a
And this other trash folder will conflict with Gmail one, leading in most of the cases your mails being put in the Gmail Trash instead of your custom one.
One simple fix I found is to Unsubscribe to the Gmail Trash folder. This way you have one single active Trash (your custom one / Archives), et voilà.