The bug was completely elsewhere than I thought. I was just about to send a debug patch for some of you to test, but immediately after that I managed to reproduce it myself. :) So this should finally get rid of the problem:
http://hg.dovecot.org/dovecot-1.1/rev/8cc0eaec7d0f
signature.asc
Description: This is a digitally signed message part