Using Keyconfig for creating shortcuts in Mozilla products has been around for a long time. With Thunderbird 3 I struggled with figuring out how to create a shortcut to compact/expunge the current folder. The examples that show up in a Google search tend to be the solution for compacting all the folders. This tends to be time consuming if you have even a moderate amount of email. The solution was provided here:
Adding a Compact Folder Button to Thunderbird 3.0If you are familiar with Keyconfig the short answer, without visiting the site, is the following key command:
goDoCommand("button_compact")
This will compact and expunge the current folder.