This is a known Mail.app issue: https://discussions.apple.com/thread/3083760?start=0&tstart=0
Select the Mailbox (probably your Inbox but any folder that has gotten confused) and choose Rebuild from the Mailbox menu.
There is a rebuild option for every IMAP email client because this happens to everyone at some point.
