It is likely only a coincidence that the ping time is decreased. /flushdns clears out the local DNS cache. All that means is that the next time you search for somethiong or try to go somewhere on the internet, the computer queries its configured DNS server to determine where to go rather than relying on the cache to resolve recently visitied locations.
You are still using the same DNS servers and they are still resolving the same name to the same IP.
One of two thinks likely happened.
1) The connection was given to one of several servers in a cluster which uses the name/IP to which you are connecting. That server was probably not as congested with IP traffic as the one to which you were originally connected.
2) For some reason the path to the end destination was passed through different routers based on the routing metrics in the routers handling most all internet traffic. But that has nothing to do with DNS.