I'm thinking of Inigo Montoya in "The Princess Bride." It's funny in a sad way how he fixates on wanting to say, "Allo. My name is...[etc]." Then in the castle fight it's pretty funny. And finally his "punch line" to his "joke" at the end. That was powerful, because there was humor, hatred, rage, helplessness, and vengeance all mixed up. You cheered for him, high-fived him for the cleverness, and yet mourned with him that satisfying his vengeance still left him empty -- he could never have his father back.
My point: Jokes don't always have to be "haha" funny to be effective. In fact, during the worst times, the crisis moments, they really shouldn't be "haha" funny. At that point, re-use an often-repeated joke -- only now it's not funny.
You could also study "Stargate SG1." That's a TV show, not a book, but Jack's character is, IMHO, a great example of what you're talking about.