Consider the following:
- I congratulate him.
- He won the race.
- I congratulate him who won the race.
I think these are straight-forward. The object of the main clause becomes the subject of the relative clause, so I have switched from accusative him to nominative who.
But what about where a single relative pronoun is used:
- I congratulate who(m?)ever won the race.
Should the relative pronoun be considered accusative, as the direct object of "congratulate", or nominative, as the subject of "won", or can the entire relative clause be considered the direct object of "congratulate", leaving "whoever" as the correct choice?