Fred writes:
"I don't know if you answer questions via e-mail, but I'll give it a try! The sentence is: "The prize goes to whomever comes in first."
"My friend says it should be whomever because it's the object of the preposition. I say … it should be whoever.
"Tell me I'm right. Save our friendship."
Well, Fred, to preserve your friendship (and abide by the rules of grammar), I declare you the winner.
In your example, the pronoun case (subjective whoever or objective whomever) is determined by how the pronoun functions in its own clause, not by how it functions in the main clause.
In "The prize goes to whoever comes in first," whoever is the subject of the verb comes, so it should be in the subjective case.
I can see why your friend thought the pronoun should be in the objective case. The dependent clause "whoever comes in first" is the object of the preposition to in the main clause, "The prize goes to." Even so, the case is determined not by the structure of the main clause but by how the pronoun functions in its own clause "whoever comes in first." Since the pronoun acts as the subject, it's whoever.