Son of a gun

Son of a gun is an exclamation in American and British English. It can be used encouragingly or to compliment, as in "You son of a gun, you did it!"

Definition
The Cambridge Advanced Learner's Dictionary and Webster's Dictionary both define "son of a gun" in American English as a euphemism for son of a bitch. Encarta Dictionary defines the term in a different way as someone "affectionately or kindly regarded." The term can also be used as an interjection expressing surprise, mild annoyance or disappointment.

Etymology
The phrase is found in a piece of comic verse from 1726: "You Apollo's son, You're a son of a gun, Made up with bamboozle, You directly I'll puzzle;"

A 1787 correspondent to The Gentleman's Magazine suggested that the phrase originally meant "a soldier's brat".

The phrase potentially has its origin in a Royal Navy direction that pregnant women aboard smaller naval vessels give birth in the space between the broadside guns, in order to keep the gangways and crew decks clear. Admiral William Henry Smyth wrote in his 1867 book, The Sailor's Word-Book: "Son of a gun, an epithet conveying contempt in a slight degree, and originally applied to boys born afloat, when women were permitted to accompany their husbands to sea; one admiral declared he literally was thus cradled, under the breast of a gun-carriage."

Alternatively, historian Brian Downing proposes that the phrase "son of a gun" originated from feudal knights' disdain for newly developed firearms and those who wielded them. An American urban myth also proposes that the saying originated in a story reported in the October 7, 1864 The American Medical Weekly about a woman impregnated by a bullet that went through a soldier's testicles and into her womb. The story about the woman was a joke written by Legrand G. Capers; some people who read the weekly failed to realize that the story was a joke and reported it as true. This myth was the subject of an episode of the television show MythBusters, in which experiments showed the story implausible.