Are you using the Particle.keepAlive() function with your 3rd party SIM?
I would try setting to a very low value (30 seconds) and see if OTA flashing works. If it does, then try to increase it until it stops working. The value should be between 30 seconds and several minutes for most SIM cards.
The reason is that cloud-to-device transmission works by sending UDP packets from the cloud to the Electron. There is a mapping set up on the carrier’s network to make this possible. Since it uses up the carrier’s resources to keep this mapping active, they turn off the ones they believe to be idle and no longer used. The Particle SIMs have a really long idle timeout, 23 minutes, and that’s the default on the Electron. Most SIM cards are at most several minutes, and can be as low as 30 seconds.
Also, you can try putting the Electron in safe mode (breathing magenta) before flashing. Hold down RESET and MODE, release RESET, and hold down MODE until the main status LED blinks magenta. Release and wait for it to go through the normal startup cycle of and finally breathing magenta before doing the flash. This is useful because it eliminates your code as a source of OTA flashing problems. Using too many system resources or failing to service the cloud fast enough in your code can affect OTA flashing. This is merely a debugging technique; it’s usually fairly easy to make your code compatible with OTA flash; this technique is just to find out if you need to do that.
Note for safe mode on Electrons with 3rd party SIM cards: This will only work if you’re previously run a program that sets the APN, either your code or Tinker with your 3rd party APN and have not powered down the Electron. The APN setting is not stored in configuration flash, but it is stored in the modem, and resetting or going into safe mode does not completely reset the modem, so the APN setting will stick around for a little while.