Mail.app has been acting a little strangely for me on 10.5 (incorrect unread message counts for mailboxes, occasionally stalling for a minute or so before displaying a message - especially while synchronizing).
Some searching online led me to suspect that the Envelope Index sqlite database was in in need of a vacuum.
Procedure:
1. Quit Mail.app
2. Run $ sqlite3 ~/Library/Mail/Envelope\ Index vacuum
3. Wait.
4. Launch Mail.app
So far, it seems to have helped immensely. (In a year or so, I'll probably need to search for this post to do it again - it might make sense to turn on auto_vacuum, but it looks like it needs to be turned on before the tables are set up).
Holy crap, this is awesome.
I'd noticed that behavior too, mostly when I woke the computer up in the morning.
So, it fixed it for you? Excellent!