Lion resolving DNS names when querying server directly, but not when used in a command or app
Killing mDNSResponder fixed this issue.. but why?


Because you flushed the local DNS cache!

http://support.apple.com/kb/ht5343

A direct lookup command will query the DNS server directly, however the resolution mechanism for just about anything else is that mDNSResponder process you killed.

dscacheutil -flushcache is deprecated as per the KB.