Nothing kills humor like trying to analyze it, but I have to say this. No one uses Homer's preferred expletive correctly.
D'oh is used to express profound disappointment, but it is rarely (if ever) the punchline itself. The humor is derived from the situation itself, not the idea that Homer is using a funny word in place of "Damn!" Here are a few examples.
Homer opens a bag of chips in front of the TV, but each time he pulls one out of the bag, a puppy jumps up and snatches it from his hand, eliciting a "D'oh!" every time.
His frustration and the animation of a little flying dog appearing out of frame 3 times in a row is funny. Homer could be yelling "No!" and the scene would still work. But take the flying puppy thieves away and it's not funny.
Moe: Whatsamatta, Homer? It's the hottest ladies night in months and you're not even checking out the action.
Homer: Oh Moe, my wife gave me the ol' heave-ho because of some lousy picture.
Moe: [pointing to a copy behind him] What, this one?
Homer: D'oh!
Moe has the punchline, whereas Homer is just reacting.
Homer: Now, remember! As far as anyone knows, we're a nice, normal family.
Lisa: Hey Bart! Last one in the fountain's a rotten egg!
Homer: D'oh! [chasing after the two] Be normal! Be normal!
Al Brooks (or Matt Groening, I forget) once said you can derive a lot of humor from two people with opposing goals. In this scene, Homer has taken his family to a company picnic and is terrified that his family will somehow get him fired for being dysfunctional. The first thing his kids do is jump in his boss's fountain.
Once again, "D'oh" is used as a reaction, but not a punchline. That comes next, because the idea of yelling "Be normal!" at your family is in itself counter-productive and, to beat a dead horse, funny.
But a lot of people think the word itself is what's funny. I've seen countless people break out the over-used word to get laughs. And most of the time it works. This weekend on NPR Scott Simon brought on their movie critic to discuss the movie, and I had high hopes for an insightful review of the movie. It started like this:
Scott Simon: [excerpt] ... That's from The Simpsons The Movie, which opened this weekend. Our entertainment critic Elvis Mitchell has seen it, and joins us from our studios in New York. Elvis, thanks for being with us!
Elvis: D'oh!
SS: [hearty laughter]