iPhone died, then started working
While not a definitive answer, I know someone with an iPhone 4 that did something very similar. After it happened several times, they contacted Apple support, and it was replaced under Apple Care. There's nothing that I'm aware of that you can or should do to help it, and if it starts happening more regularly, you should obviously contact Apple support.

I'm confident you already understand this but while it could be a mere coincidence, factors such as extreme heat, and water damage could possibly have the same effect.