David (and all others),
I did a bit more playing around and ran a script that seems to repair the index, to the effect that the offending "hidden e-mail" popped up once I ran it and did a mailbox sync. To wit:
- Close Mail.
- Open Terminal application (Applications/Utilities)
- Copy and paste this script:
sqlite3 ~/Library/Mail/V2/MailData/Envelope\ Index vacuum;
- It will take about ten seconds to complete, whereupon you will be brought back to the prompt.
- Close Terminal and re-start mail.
- I find it is helpful to also open the activity window in Mail to see what it's doing, since it may take a bit to churn everything.
- The Activity Window is invoked by going to the "Window" pull-down then select "Activity."
- At this point, I first went through all of my mailboxes and selected "Mark All as Read" from the settings, if it was not greyed out (I used the one on the sidebar at the bottom that looks a bit like a gear-wheel. It also has other options such as delete mailbox, if that helps describe it better).
- Once I used that option through every last mailbox, including offline boxes I use as repositories for mail rules, I ran a full mail Synch (Pull down menu "Mailbox/Synchronise All Accounts) and let it do its thing.
- After monitoring the Activity Window and seeing it was all done, I scrolled through my mailboxes and there was the naughty e-mail that had been hiding away. When I opened it, my Unread Smart Mailboxed cleared right up.
I hope that helps or works for you and others.