The story of the real-life moth as a computer "bug" is told at length under the title "First Computer Bug." Even in this case, though, the way the people involved treated the incident suggests that the word bug was already understood metaphorically:
On the 9th of September, 1947, when the machine was experiencing problems, an investigation showed that there was a moth trapped between the points of Relay #70, in Panel F.
The operators removed the moth and affixed it to the log. (See the picture above.) The entry reads: "First actual case of bug being found."
In fact, an instance where bug is used in the sense of "system problem" appears five years earlier than that, in The Autocar: A Journal Published in the Interests of the Mechanically Propelled Road Carriage, volume 87 (1942) [combined snippets]:
I think everyone will agree that there is a "bug" in the system when, in times of peace, poverty can exist amidst plenty. In fact, during a slump, food is actually destroyed whilst hungry people have no jobs and in consequence insufficient money to buy the food that is being destroyed. Under the existing monetary system everyone is fully employed only in times of war! What a system!
Another early use of bug in this metaphorical sense is from United States Investor, volume 61 (1950):
We are neither Republicans nor Democrats ... Protestants, Catholics nor Jews ... white nor black. We are just Americans who believe that the Democratic system is the best there is, but who also know that the system has "bugs" in it that have to be exterminated in order that democracy can come to its full flower of liberty and service for every citizen.
These "bugs" are not the fault of any particular political party or individual. They have developed within the framework of the executive branch of the government, that has, like Topsy, "just growed".
In both of the preceding examples the buggy system was political or economic. But in answer to an EL&U question (Origin of "bug" in reference to software) posed back in September 2011, researcher extraordinaire Hugo noted that bugs is used in a logbook entry from April 17, 1944, at Harvard’s Computation Laboratory (as reported by Peggy Kidwell in an article published in IEEE Annals of the History of Computing (December–October 1998)) in the specific context of computer operation, three years before the much-discussed moth episode:
Ran test problem. Mr. Durfee from I.B.M. was here to help us find “bugs.”
Oxford Dictionaries online finds a much earlier instance of bug—this time in connection with the new technology of audio recording. From "Was the first computer 'bug' a real insect?":
The term in fact originates not with computer pioneers, but with engineers of a much earlier generation. The first example cited in the 20-volume historical Oxford English Dictionary is from the Pall Mall Gazette of 11 March 1889:
Mr. Edison, I was informed, had been up the two previous nights discovering 'a bug' in his phonograph - an expression for solving a difficulty, and implying that some imaginary insect has secreted itself inside and is causing all the trouble.
The upshot is that bug was in use as a metaphorical or figurative term for a systemic problem in 1889. Whether that makes it a slang term more than a hundred years later is a matter of opinion, I suppose—but the notion that prior to the first figurative use of "computer bug," a bug was strictly and literally an insect appears to be incorrect in any case.