This happened to me recently in trying out a joke for my new show. I recalled a funny situation which occurred dating somebody else who had been through some childhood trauma.
At the point where I say to a woman in the audience 'don't worry, you can laugh', I had seen her covering her mouth and trying to stifle laughter. She found it funny, but felt guilty for laughing. It was too honest. I was exposing too much. Instead of laughter, I got sympathy. Which is not to say I have not got laughs talking about childhood trauma, loneliness, self loathing, suicidal thoughts or despair before. In truth, if I didn't talk about my vulnerabilities, I would not have an act. It's just a matter of being VULNERABLE BUT NOT TOO VULNERABLE.
Sometimes just altering my performance is enough. If I talk about something horrible in my past or a deep insecurity with a big smile on my face and a confident veneer, the indicator is, 'I'm totally ok with this, you can laugh'. This is all very well if I am actually OK with it, but sometimes faking it is necessary. This can backfire. If you make a self deprecating joke about something you're still insecure about and the audience laughs because you're acting, you are helping them bully you. I once told a friend to stop doing a certain joke about her weight, not because she wasn't getting a big laugh, I just saw that it was making her miserable to get that laugh.
I think the best place to alter the joke is at the conceptual stage. At times I will do a little factual alteration. For instance if I tell a painful story about my relationship with my father, but make it an uncle, that distance makes the story feel more fictional. With the 'minefield' joke above, in draft two I may try looking into triggers in conversation not in the bedroom, or come up with an absurd way to illustrate the point.
Case in point, recently I tried another joke about pain. This one was more successful because I enveloped it in an absurd idea for a holiday.
See. Suicidal thoughts can be a punchline.