Mavericks GMail mailbox loses messages
If it happens again, try the following:


Right click any Gmail folder that is missing messages and select "Get Account Info". 


This forces Mail to search through the entire Gmail account for messages and will restore missing messages in all folders for that account.

The missing mail problem occurred for me when I upgraded from Mountain Lion to Mavericks 10.9.1 with Mail 7.1 (1827). I had unsuccessfully tried:


clicking "Get new messages in all accounts"
synchronising the mailbox
taking the account offline and then back online
rebuilding the mailboxes
un-enabling the account, restarting Mail and then re-enabling the account.


Only getting the account info solved the problem for me.