Thunderbird creates a temporary file called "nstmp" when it’s compacting a folder. If Thunderbird is interrupted during the compacting, it will abort, and the temporary file will not be deleted. If the problem occurs multiple times, you’ll see numbered files ("nstmp1", "nstmp2", etc.).
Shutting the program down during the compacting process, whether intentionally or due to a crash, will interrupt the process. Receiving a new message in the folder you’re compacting will also interrupt the process. You can avoid the problem by switching to working offline ("File -> Offline -> Work Offline") before you compact a folder, but thats a nuisance. Usually you can prevent this problem by keeping your inbox as empty as possible (store messages in other folders/child folders) and setting "Tools -> Options -> Advanced -> Network & Disk Space -> Disk Space -> Compact disk space when it will save over" to a lower value.
Check to see which folder the nstmp folder is duplicating, and check that the original folder is okay (e.g. compare number of messages in "View -> Toolbars -> Status Bar"). If so, you can delete the "nstmp" folder(s) by right-clicking it and choosing "Delete Folder" (or by deleting the files in your profile).