I use Mail.app for reading my emails via pop3s and imaps and I noticed that some messages were randomly getting flagged as unread. Sometimes the message would stay read forever, other times I had to mark it 10 times as read and a couple of hours or days later it would become unread again.
This was really frustrating and even though I tried googling around, I couldn't find the cause or resolution for this problem. When asking others, nobody knew or suffered from the same issue and that gave me hope that there must be a fix or a way to avoid it.
Last night enough was enough and I googled again. I don't know if I used the right combination of keywords, or if Google's index got better, but I found a forum thread discussing the very same issue I was having!
Apparently GPGMail (an extension that integrates GPG with Mail.app) is responsible for this. Sure enough, the author even acknowledges the issue on his site.
Q: Since I installed GPGMail, some read messages have their 'read' status come back to 'unread'. What's happening? A: It's is a bug in GPGMail that I've been unable to fix yet. The only workaround that works for most people (but not all) is to disable automatic decryption/verification of emails.
The workaround didn't work for me, uninstalling the extension did!
I'm not thrilled by not having GPG support in my mail client, but for now I'd rather be without GPG than having to bear with ~500 unread emails in my mailbox.
Since in my case the issue is repeatable (even after reinstalling MacOSX), I can provide any necessary information to the author if he's interested in fixing it.
In my opinion the issue has something to do with imap or imaps mailboxes and I wouldn't be surprised if many people at Sun would be suffering from the same issue, since imaps is the default mail retrieval protocol at Sun.