I agree that Jeffrey Hoover's tip was the correct answer. Flushing the DNS cache and restarting the Mac is a nice step too. This is variant of Jeff Hoover's reply:
sudo -i
Password:
for n in HostName ComputerName LocalHostName; do
scutil --set $n new_hostname
done
exit