In Leopard do:

sudo dscacheutil -flushcache

In Linux (Ubuntu):

sudo /etc/init.d/nscd restart

Update:

In OS X Yosemite:

sudo discoveryutil mdnsflushcache

In OS X Mavericks, Lion, Mountain Lion:

sudo killall -HUP mDNSResponder