'Gee' is an English modal particle which, in modern times, is usually used to indicate sarcasm.

It originated as an Americanism in the 1840s or 50s -- we do not know how long it might have existed before it was written down. Its first recorded appearance, in 1851, was in the phrase 'gee whillikens', which may indicate that it was established enough by that time to have garnered humorous elaboration. It is generally accepted that it was a minced oath, either a replacement for 'God', or an amputation and recovery of an inappropriate 'Jesus!'.

For many years its primary use was to express surprise ("Gee whiz!"), often in conjunction with disappointment ("Gee, why'd you go and do that?") or sympathy ("Gee, that's terrible"). It was also used as a general form of emphasis, cf. Gee, It's a Wonderful Game. Over time, it became a milquetoast exclamation used primarily by the elderly, and then by young children.

As a result, when an adult uses it today there is a good chance that they are being sarcastic or ironic, as in the stock phrases "gee, I never would have guessed" and "gee, thanks". However, tone of voice plays an important role, and you may still hear an unsarcastic "gee, that's right" or "gee, I don't know", indicating mild surprise or puzzlement.

While there is always some uncertainty when dealing with slang, the consensus appears to be that, when refering to a thousand dollars or when used as a shortening of gangster (the purported origin of the popular "yo, what up, G?"), it should be spelt 'G'. However, both G and gee are pronounced exactly the same.