Fix bug in g_msgids() affecting Gmail message deduplication.

We occasionally were failing to deduplicate message object creation or
download because we wrongly excluded messages which currently had no
associated ImapUids. (This is actually a common situation, as when a
message moves we might well delete the old ImapUid before creating the
new one.)

Fixes T180.