2. <programming> A clever programming trick intended to solve a particular nasty case in an expedient, if not clear, manner. Often used to repair bugs. Often involves ad-hockery and verges on being a crock. In fact, the TMRC Dictionary defined "kludge" as "a crock that works".
3. Something that works for the wrong reason.
In 1947, the "New York Folklore Quarterly" reported a classic shaggy-dog story "Murgatroyd the Kluge Maker" then current in the Armed Forces, in which a "kluge" was a complex and puzzling artifact with a trivial function. Other sources report that "kluge" was common Navy slang in the WWII era for any piece of electronics that worked well on shore but consistently failed at sea.
However, there is reason to believe this slang use may be a decade older. Several respondents have connected it to the brand name of a device called a "Kluge paper feeder" dating back at least to 1935, an adjunct to mechanical printing presses. The Kluge feeder was designed before small, cheap electric motors and control electronics; it relied on a fiendishly complex assortment of cams, belts, and linkages to both power and synchronise all its operations from one motive driveshaft. It was accordingly tempermental, subject to frequent breakdowns, and devilishly difficult to repair - but oh, so clever! One traditional folk etymology of "klugen" makes it the name of a design engineer; in fact, "Kluge" is a surname in German, and the designer of the Kluge feeder may well have been the man behind this myth.
TMRC and the MIT hacker culture of the early 1960s seems to have developed in a milieu that remembered and still used some WWII military slang (see also foobar). It seems likely that "kluge" came to MIT via alumni of the many military electronics projects run in Cambridge during the war (many in MIT's venerable Building 20, which housed TMRC until the building was demolished in 1999).