We have had a problem recently with dovecot corrupting it’s index files. I do not know exactly when this started. The version that Ubuntu provides is 2.3.11.
I recently changed the mail client server from keeping things on an NFS mounted partition to local disk as the general consensus within the dovecot community seemed to suggest this was a NFS related problem.
However, that did not resolve the issue. Today I compiled the most recent version, 2.4-devel and installed it. I also changed the locking from fcntl to dotlock which is slower but generally considered more reliable.