Materials are stored in your personal storage not your cargo hold. Have you got your keybinds mixed up? The [END] key ejects all cargo, so if you have assigned this to a function in another program you might be ejecting your load accidentally (it happens to all men eventually).
There are "PLENTY" of Blueprints that require commodities, which ARE stored in your regular cargo hold. I assume based on the OP's story that these are what he lost. Not the materials that are not subject to issues with the cargo hatch malfunctioning.
I suggest that everyone always check the REPAIR tab at Stations and Outposts to make sure that their ship's "Integrity" is 100%. IT often happens to me that even if you repair your ship right when you arrive using the buttons below the refuel button, you integrity might still be below 100%. Flying a lot of SC or doing multi-system jumps for hours on end will definitely wear down your ships integrity.
This could have been behind the cargo hatch malfunctions.