Arduino locks when magnetic contact sensor is attached

The ATmega SPI hardware only uses pin10 when configured as an SPI slave, it doesn't use it at all if an SPI master as is usually the case. So perhaps you have SPI set up in slave mode and enabled?

[edit: actually even then it shouldn't lock up the processor, the problem could be something else like noise/spikes on that signal line]