Have you tried to export instead of save for web? Where is Photoshop Scratch set to? Is it setup? How big is it in relation to the document size (lower left status bar). Photoshop also uses GPU acceleration, which may be interfering with background applications (terragen, other programs that use GPU) also trying to access the GPU RAM, where if enabled, some caching is happening and could be causing a problem.
I don't know how much RAM you have, but one thing I found useful for school (because the CPUs were rather slow) was to use the RAM as a RAMDisk for scratch. It worked well for saving files very, as well as making edits to the projects almost real-time (minus filters)
Also, is Terragen open during this problem? Sometimes when Terragen is open taking up a good portion of my RAM (this machine only has 3.5 usable GB, well under recommended for both applications), Photoshop will simply not respond, nothing in the UI is clickable. Or when I try using tools, they won't do anything. Closing Terragen solves this, or possibly restarting Photoshop but in most cases I'd get one of the two problems again if I didn't close Terragen.