That is such a hard line to draw. Something racist, for example, should be called out, and I wouldn't mind if that totally derailed the thread, although I would feel sorry for an innocent OP who didn't have their question answered.
But sometimes, what derails it is totally tangential but it hits someone's hot button, and all bets are off.
But who is to say where that line is drawn? I think that a discussion such as this helps a lot.
Interesting question. Out of a long thread, two or three posts that aren't exactly on point don't bother me too much. Like if someone says, "Excuse me, but what does her having purple hair have to do with anything?" because being judged for having an unusual hair color is a hot button for them, and someone else says, "Well, it explains why the OP didn't immediately recognize her again later, when her hair was brown," and the first person says, "Oh, okay, thanks, I missed that." I don't think that exchange is too distracting, as long as people get back to the question in the OP afterwards. Or maybe the OP will say, "You're right, I shouldn't have mentioned the purple hair, it has no bearing on the issue," and the first person says, "Okay, thank you," and again the discussion gets back on track. It's kind of like what they say in class--if YOU have a question, probably lots of other people have that same question but just don't want to ask it.
I think bad derailments come when the person who starts the tangent just won't let it go. Like, if someone tries to explain why the purple hair was important to the story, and the Tangenter just keeps saying, "No, I don't get it," followed by a philosophical treatise on the value of hair color as it relates to personal identity, prompting other people to post with comments either for or against the purple hair--that's when things go downhill.
On the other hand, as someone else mentioned, sometimes the main issue of the thread has run its course, and following pleasant tangents seems like a natural part of good conversation. It can be a little difficult to tell the difference sometimes, and I think the OP can help with this--they could reply and thank people for contributing if they feel they've gotten the answers they need, for example, or reply to say that they're still confused about something. That might give people a clue as to whether the OP feels they were sufficiently advised or not.
Glad people think this is a productive discussion!