The neutral and ground are typically bonded at the load center, and usually earthed near the service entrance (assuming you're in the U.S.).
So, going hot-to-dirt is the same as hot-to-neutral, but with a lot of resistance.
The real key is that you're getting a shock. The housing of a metallic tool is typically grounded so that if the hot wire comes loose and touches the case it will short and trip the breaker. That prevents you from getting shocked.
So my guess would be that somewhere in the wiring, the hot and neutral wires flipped and the ground isn't connected or making good contact either in the wiring, the extension cord, or the tool (if it was, it would trip the breaker). So, when you touch the tool you become the circuit in hot-to-ground and Zzzzt!
Hope that helps, please let us know what you find.