In the following sentence, the need for the at preposition is clear:
"He threw something at him"
However, if I started the sentence the other way round, it would feel (at least to me) as if the preposition was no longer needed:
"He threw him something"
The question is:
Is it correct to omit the preposition when the person (indirect object?) is mentioned first?
UPDATE: This would seem at a first glance as a normal Dative Alteration, as many of the responses told, but a Dative Alteration also implies the use of "to" or "for" prepositions, because the indirect object should respond to "to whom" and "for whom" questions. So, since in this case the preposition at use is "at", what happens to the alteration? Is it still a valid Dative Alteration?
UPDATE: After the overwhelming responses that stated that what follows the preposition "at" is not an indirect object, then the case of the Dative Alteration does not apply, apparently turning the alteration from "He threw something at him" into "He threw him something" invalid.
Nonetheless, I've googled a lot on this matter looking for appearances of "threw him a" (expecting a following noun) and found no contradicting results. In all cases what followed was a noun that always meant some kind of help or utility but no harm (a slice of bread, a coin, a handkerchief, a smile, a kiss).
The only exception I've found was in the case of baseball, where pitchers "threw batters a slow or fast ball", in an attempt to make the batter miss the ball, instead of actually catching it.
All things considered, I'm closing the question, and finally accepting John's answer (and comments) as correct.
Thank you.