As an added note, device keys corrupting is known to be related to this bug bounty. Bug Bounty: Electron not booting after battery discharges completely
The article a bit dated, as it refers to the Electron specifically, but can occur with the Photon too.There seems to be an issue with the STM32 microcontroller having a rare instance of corrupting the flash at different areas. In most extreme cases, it can be the bootloader, but I have taken note of it occurring with keys, wifi credentials, and at times, even device OS and user applications.