The judgement of whichever moderator stumbles upon the post first has a lot to do with it. There isn't like a flowchart or anything that we all follow, we each enforce the rules that are publicly available to the users and simply try to do what we feel is right under the circumstances. I tend to be on the stricter end; other moderators are often more lax.
My personal philosophy when it comes to when to kill individual posts (usually by hiding them from public view, but occasionally outright deleting them if they were contentless enough that there is no plausible need to refer to them) rather than to lock a thread is if there is any hope that a meaningful, interesting conversation could theoretically be had should the bad posts be excised. If it's possible to keep a discussion going (for example, if there's a good conversation going on a topic and a noxious side discussion starts), then I kill the bad posts and leave the thread going. If the whole thread is noxious (e.g. if it started as a bad trolling attempt, or there is no way to continue with it while following the forum rules, or the users insist on relitigating whatever issue was discussed in the killed posts), then a lock is warranted.
Generally I won't kill an entire thread, unless being public and locked makes it a likely source of disruption elsewhere. For example, if someone were to make a thread titled "webny99 sucks!" filled with insults, there is really no good reason to leave it public, since it serves no purpose other than to try to make you upset, and if it succeeds it could cause you to escalate the matter when you encounter that user in another thread. Another example of a thread I would hide is if a thread reflects badly on the community, e.g. they're racist, sexist, homophobic, etc. It is better to hide those sorts of threads to prevent undue harm to any members that fall in the class it was directed at reading it.
In general, though, we have no hard and fast rules about when to do what, so a thread I might leave in place might be a thread that Steve would hide, or vice versa.