Jokes and Their Relation to the Unconscious (1905) is considered to be one of Sigmund Freud's most notable early works. Together with The Interpretation of Dreams and The Psychopathology of Everyday Life, this books forms the basis for the psychoanalytic thought as presented and later developed by Freud.
After discovering that hidden mechanisms operate under the surface of our consciousness Freud was looking for a way to go around or penetrate the walls blocking important information and mental content of patients. Two of his solutions were dreams (suggested in The Interpretation of Dreams) and everyday mistakes and slips of the tongue (suggested in Psychopathology of Everyday Life). In Jokes and Their Relation to the Unconscious Freud holds that what produces laughter and makes jokes enjoyable to us is the fact that they serve to disguise and cover up more serious matters. Saying it in a joke allows us to utter things that would otherwise be stuck and repressed.
You know how they say that every joke has a kernel of truth? well, Freud thinks that if we listen hard enough to the joke, and not just laugh from it, we might discover something important of what's going on inside the joker. Freud holds that we must learn the techniques which produce jokes in order to understand and trace their hidden origins.
Freud later developed his thoughts in Jokes and Their Relation to the Unconscious with the introduction of his structural theory (see The Ego and the Id). Freud argued that the superego usually does not inhibit jokes in the same manner that it does regular speech, granting much more freedom for the subconscious to express itself.
Summaries of important works by Freud:Sigmund Freud - The Interpretation of Dreams
Sigmund Freud - Civilization and Its Discontents