1. Earliest use in the neutral sense of speedy in "Dear Mr. Banker", by Nicholas P. Mitchell, published in The Greenville News of
January 14th 1950:
"By the way, in spite of the fact that various Greenville bankers have explained to me why it isn’t a good idea, I still wish every bank had at least one teller’s cage reserved for people who want to cash a check or to make an
individual deposit. Such transactions require about half a minute, but it is not unusual to wait in line
fifteen minutes or more while those who are banking on behalf of business get their requirements met. ... But if we small fry had a “wham, bam, thank you ma’am,” line of our own, we’d all save a lot of time."
The phrase merely referred to suddenness before it was used as a slang for quick sexual intercourses.
2. The earliest occurrence of wham, bam, thank you ma’am with
reference to sex is from the review of Ball Four (World Publishing Co. – New York, 1970), by the
American baseball player James Alan Bouton, hence 20 years after its first use as an adjective. Bouton's review was published by John Justin Smith in the Star-Gazette (Elmira, New York) of June 10th 1970:
"Bouton says of ball players that they are not, by and large, “the best dates. They prefer wham, bam, thank you, ma’am affairs.”
3. It's used in the military to denote a sudden, forceful effect. Feel free to also use it to denote any sudden, quick action or effect, not just sexual ones. The intended meaning is highly contextual.