OSX seems to ignore /etc/hosts file during DNS resolution. If you google it you will find thousands of results for different versions of OSX and hundreds of comments "it works for me" or "it doesn't work for me". The solution that worked for me I found in a comment of a blog entry. Permissioning. After adding global read access to /etc/hosts everything works as expected.
sudo chmod o+r /etc/hostsThat's it. Hope it helps someone out there.