Mac exhibiting inexplicable network disconnects?
It sounds like you're having DNS issues. Most Cocoa apps make DNS calls that are handled via mDNSResponder nowadays, so if the mDNSResponder process is having a problem, even traditional unicast DNS lookups will fail.  Next time this happens, try...

sudo killall -9 mDNSResponder


...this is sure to kill mDNSResponder. Don't worry, launchd will automatically restart it.

It's possible that whatever was causing mDNSResponder to hang was cleared up by your troubleshooting steps, or maybe you triggered a network configuration change that cause mDNSResponder to reload itself.

There are still a few command-line tools that use traditional Unix DNS resolver libraries that don't leverage mDNSResponder. These include host, dig, and nslookup.  Another way to see if it's just mDNSResponder and not DNS in general is to use one of those three tools to do a DNS lookup the next time the problem happens.

I also agree with another user's suggestion to ping a host by IP address. I would recommend that you do...

ping -n 8.8.8.8


...the -n tells ping not to try to do a reverse DNS lookup on the host you're pinging. 8.8.8.8 is a nice memorable IP address for one of Google's publicly-accessible resolving DNS servers.