I think you can say both He gave it me and He gave me it (in the sense of He gave it to me), so word order is not the only thing marking theta roles (if I got my term right).
Some combination of context, typical roles, and animacy hierarchy? Vestiges of a dative/accusative distinction in pronouns, rather than being lumped together as "objective case"?
On the other hand, you can say (well, I can say) He gave me the book but not *He gave the book me.
Or am I (in finding He gave it me grammatical) transferring from German, where the typical word order is Er gab es mir? (Er gab mir es would probably be grammatical, but sounds quite strange to me stylistically. But with a noun, the order would usually be like that: Er gab mir das Buch. Er gab das Buch mir sounds unusual, perhaps if you wanted to emphasise that it was me to whom he gave the book, but even then you could express that with the more usual word order.)