Consider a comic using material they KNOW will bomb, simply to troll the audience. (Norm Macdonald and Andy Kaufman loved this kind of thing.) That situation is itself a joke, by the performer and for the performer, and at the audience's expense. Essentially a prank.
My favorite example is a comic delivering a mediocre routine that isn't really funny, and hoping the audience is drunk enough to let them get away with it. They don't. The set bombs and the comic chokes hard and goes down in flames. No laughs at all--the audience is annoyed and the comic is humiliated. No laughs that is except for another comic performing that night, witnessing this situation as it unfolds, recognizing what's happening, and laughing at how perfectly awful the circumstance is for all parties involved. HE found it funny. Bam, the whole set was a joke!