First, if you have a good PSU, it should electronically shutdown before it fries anything else. That's an often overlooked benefit of a good PSU.
Second, the CPU and RAM are "insulated" from the rest of the motherboard by their of power regulators.
Third, a short represent a lower resistance path to ground than any CPU or RAM chip.
The CPU and RAM should be OK. Why?