It is a saying one shounts after being greatly startled or shocked.
*Son gets shot infront of dad* Dad: "Oh Good Heavens!"*Dad watches his kids get turned into red mist while playing by the road by a giant truck going 200.* Dad: "Oh Good Heavens!"