I found a work-around. In Gmail settings, I un-checked all the inbox categories, leaving just the priority inbox. So all incoming mail goes there now. The missing emails returned, and IMAP all mail filled up with emails. I don't like categorised emails!