I would decrease the amount of swap space you have available. Typical installs these days attempt to allocate as much swap as there is physical memory (or sometimes twice as much). The problem with this is that when something goes awry, the system goes into a death-spiral of attempting to "shuffle" things from memory to disk, and back, and it starts doing so much of that it doesn't have time to respond to user input.
In the good-ol-days, entire processes were swapped out to disk (and back), hence large swaps were needed.
In modern virtual memory systems, memory is swapped out in blocks (rather than whole processes), so you can get by with smaller swaps. In your scenario, you'd be better off having processes killed, so running with smaller swap will cause OOM to start killing processes sooner (rather than having the system spend inordinate amounts of time swapping stuff to/from disk).