When (in Literature) Did "Gay" Begin to be Used?

The use of the word “gay”, as a synonym for homosexual: when and where did it start?
I am under the impression (I’m sure I am wrong) that “gay” is a 1960’s term…am I wrong?

The Master speaks !

As indicated, the term was used as far back as the 1930s (and even earlier), but did not become mainstream until around 1970. Homosexuals actually liked it that way: in a time when they could get in a lot of trouble with the law, it was a way to identify other gays without danger.

For instance, if you saw a likely man, you could go to him and ask if he knew where to find a gay time. If he’s straight, he would give a variety of answers, but if he were gay, he would know exactly what you were asking.

Two previous threads on the subject.

http://boards.straightdope.com/sdmb/showthread.php?s=&threadid=55582&highlight=homosexual

http://boards.straightdope.com/sdmb/showthread.php?t=170184&highlight=homosexual