The handling of gems and quests is automatically saved when events occur. Inventory is only saved when the client is exited. So when you get gems and the client crashes before you log out, you lose the gems. They were not saved in your inventory because you didn't exit out the normal way but the database (or server not sure) has it registered that you already received the gems. I have lost gems in this manner before.
It really stinks and along with lost inventory is the major drawbacks of crashes.