I think that "pescado" is the participle form of the verb "pescarpescar", which means "to fish", so I guess that once you fish a fish it turns from "pez" to pescado".
Pescar: Sacar o tratar de sacar del agua peces y otros animales útiles al hombre
So the difference is not that the creature is alive or cooked, it is that it has been "harvested" from the sea/river/lake/etc. by human hand.
You could see a lot of dead fish on the sea shore and you would still refer to them as "peces", not as "pescados". Once a fish is cooked or ready to be eaten supposedly it has been fished first, so it is called "pescado".
Pescado: Pez comestible sacado del agua por cualquiera de los procedimientos de pesca.