Flaps,
We all know that in the natural world air wants to move from a high pressure to a low pressure environment. In a gas turbine engine we are making the air flow from a low pressure environment (ambient) to a high pressure at the end of the aptly called "compressor".
This is all well and good if the engine is working properly (it's running line). If there is a disruption to the above described equlibrium (for example a disruption of flow into the engine due to a high angle of attack) then the pressure balance/running line is affected.
In the surge scenario the natural world wins and the air starts to flow from high to low pressure, i.e. towards the front of the engine. Naturally this has rather serious consequences on the combustion process (and hence thrust etc).
Normally the engine (especially the newer ones) will recover after a cough and splutter, but some will not, and will be shut down. Depending on the intensity of the surge the compressor blades and vanes may be damaged, but I've known them to carry on functioning well even after a massive surge.
Hope that helps.