Son of a gun is defined as an expression of surprise, disappointment or frustration.
(interjection)An example of when you might say "son of a gun" is when your dog surprises you by actually listening to a command he's ignored before.
See son of a gun in Webster's New World College Dictionary
See son of a gun in American Heritage Dictionary 4
Informal
noun pl. sons of guns