I've experienced roughly the same thing. I think of it like this: when I experience an unexpectedly good outcome, I immediately feel a feeling of gratitude. Normally when this happens it is due to another person's actions (I'm given a gift or a promotion, or I'm pulled out of the way of a speeding bus, say), and as social creatures we pay attention to that and strongly associate the resultant feeling of gratitude with that person.
But it's not the person that (directly) causes the feeling, it's the circumstances. So when the feeling is caused by a good outcome that was not directly or intentionally caused by a person's actions, our brain by habit or instinct seeks out a backup candidate: God, luck, etc.
I was at a lecture by Richard Dawkins a while back, and he specifically brought up the topic of gratitude as a human parallel for (I can't remember the exact name he gave it, but wikipedia calls it Vacuum Activity). Just like a dog trying to bury a bone in the corner of the room. It also had to do with our inherent patter-matching nature, and the survival difference between making Type 1 and Type 2 mistakes (where if you falsely believe a tiger is about to pounce you, you pay a small energy cost from freaking out and running away; but if you falsely think it's just the wind, you die).
Well, I used to think that I do not believe in anything supernatural that affects what happens to me, but I'm wondering if maybe I actually do alieve in it. For example, a few days ago I had a close call in traffic, and when a collision I fully expected to happen just a second prior did not transpire, I mentally thanked... whom? I definitely had a clear feeling of gratitude for escaping, and I don't normally mean it literally when I say "Thank God!". So, who or what did I feel thankful to? I've never been religious, and I got rid of most of my superstitions over the years, but apparently there is still something there, and I do not know how to react to this knowledge.
What would be the proper reaction after a close call? Shrug and say "got lucky this time, should be more cautious next time"? What about when waiting for a diagnosis, what does sort-of-praying "please, please, let everything be OK" say about one's true beliefs? I know that I am much better at not blaming the world when something bad happens to me by chance than at not thanking the world when something good happens. Should it not be symmetric? Which part of a normally non-religious person wakes up and asserts itself in a crisis situation out of their control? Should it be embraced, suppressed, worked on?