Sudden flash of gray in the background

That is because the Dock process isn’t getting enough resources and/or is crashing.

TheDock process is not just responsible for your Dock, but also Mission Control, Launchpad, Dashboard and the Desktop background.

If this happens most frequently during periods of heavy use, then it is not getting enough resources or its resources are being swapped to disk.

If this happens totally randomly, then there is a deeper issue. Try repairing permissions first in that case and report back if it works.