How is priority determined in /etc/hosts?

Top to bottom. That's usually it.

You may want to also examine your /etc/nsswitch.conf

Other services may use a different method of DNS lookup. What application is this?

Also, check for caching daemons. Is nscd running?