WOO-HOO!
Something good happened. Use immediately.
Woo-hoo celebrates the win. D'oh marks frustration, error or the moment Homer realises what went wrong.
Woo-hoo! is the upward movement: excitement, victory, relief, delight. D'oh! is the downward movement: frustration, a mistake, a setback, or the instant Homer realises the obvious thing he missed.
That contrast is why both reactions work so well as internet shorthand. One GIF celebrates. The other admits the plan has gone badly.
The Homer decision tree
Something good happened. Use immediately.
Something went wrong, probably moments ago.
Neither. There is food nearby.