Yeah, the problem was the buggers firing the mortars were praying to their god too!
As for the no atheists in foxholes quote.
My great-grandfather returned from the Somme in the winter of 1916. He was an officer in a Welsh Guards regiment. He had been gassed and shot and had seen his platoon numerically wiped out and replaced more than three times since he first took command of it. He had used his side arm, a Webley revolver, so much that its barrel was pitted into uselessness. I heard a story about one of his advances across no-man's-land in which he set out with a full company and by the time he arrived at the German wire was one of only two men left alive.
Until that time, this branch of my family had been Calvinistic Methodists. . . But when he returned from the war, my great-grandfather had seen enough to change his mind. He gathered the family together and banned religion in his house. 'Either god is a bastard,' he said, 'or god isn't there at all.'
(Paul Watkins, "A Friend to the Godless," pp. 40-41, in A Tremor of Bliss: Contemporary Writers on the Saints, ed. by Paul Elie, Riverhead Books / Berkeley, 1995.)
"I thought [combat] would change them, because there's that saying that there are no atheists in a foxhole, and I find that's not true. Even in a battle zone there's still a fairly large number that's not practicing a faith, . . ." Army Chaplain Joe Angotti - Tikrit, Iraq
In my experience under Chinese and NK Mortar & Arty fire in Korea, I never heard such vocal prayers, etc. I can say; however, that I said a few quiet prayers to my God. Their 82 MM mortars, usualy were pretty accurate and they didn't spare there use.
During combat time, when the Chaplain showed up in my area, I attended his service and was happy to get his blessing, etc. I found that being close to death everyday, did cause me to seek help from my God and my religion, but that was just me.
On the other hand, I had a distant relitive who was a US Marine and made every one of their Island hopping invasions, in the South Pacific. He went from very religous Southern Baptist to atheist. He committed suicide later in his life. Surviver guilt? Perhaps.