A minced oath, an expression of dismay, disgust, anger, surprise etc.
Used like "what the hell" to add emphasis.
An expression of surprise, exasperation, or dismay; good heavens; oh my gosh.