First of all, handle the matter with care, because of the extreme sensitivity of your topic. I would advise finding someone who understands what your work is trying to do and have them read an excerpt that includes the joke and ask them about what they think. You wouldn't be the first person who used humor while dealing with racially sensitive subject to great effect. The film Blazing Saddles is considered one of the funniest films of all time, and much of it's humor is centered on racist jokes... but the reason it works is because the film's point is to mock people who actually genuinely believe these attitudes are unacceptable. Almost every reaction to the film by first time watchers, "That was so wrong, but so funny.... but it could never be made today" despite the fact that when it was made, people couldn't believe it was allowed to get away with some of the jokes it got away with.
Many people who study humor actually believe that the reason for the response is to cope with topics that are considered quite seriousness and help deal with it. To give one example, the Catholic Saint Lawrence was told by the Romans that he had one day to give them all of his church's treasure. Lawrence instead took every thing of value in his church and gave it to the city's poor. When the Romans found out, he was arrested and sentanced to death by being grilled to death. Large metal grill was brought and the fire lit under it, and Lawrence was placed on top of it. Legend has it that in his final moments, Lawrence turned to look at the nearest guard, his face agonized with the pain of his gruesome death, and said to the man, "Turn me over. I think I'm done on this side."
Was the moment serious? Most stories of martyrdom aren't smiles and rainbows. Was the joke funny? Well if you ask the Catholic Church, St. Lawrence is the patron saint of Cooks, Chefs, and Comedians for a reason (While not mentioned in the wikipedia article, when I had to do a report on him in my Catholic school days, my sources included mention that prior to his death, Lawrence was known for his humor and would frequently entertain his dinner guests by reading selections from his vast and numerous collection of joke books... some of his few worldly possessions. While the source never directly said it, there was a strong implication that many of these jokes were Latin Dad Jokes and that Lawrence appreciated them more than his guests.
His situation isn't common. Many a Catholic Saint's patronage relates to their death, especially the martyrs (one might find it a curious choice that the Catholic Church instructing people that the person who is best at praying for God's intercession in this matter is the person died in the same way. Though, that said, they'd be the expert in telling God he better do something because dying in that way is not fun.). Additionally, gallows humor is almost exclusively jokes told by someone about their soon to be carried out execution, such as the man who is about to be hung until dead looking over to execution while he prepares the rope and saying, "Um... that's not how you tie a noose." or the guy against the wall telling his firing squad to "aim lower" after the first volley completely missed him.
Cops and Doctors (especially ER) have seen enough serious and psychologically damaging truama can get pretty dark. It's not uncommon for a newly minted rookie cop encountering a crime scene that's so gruesome the he has to vomit, to find himself followed by some of the veteran officers he works with, all of whom are fondly remembering their first vomit inducing scene from their own rookie days... in very graphic detail... because they can never forget it... or trying to cheer the rookie up by letting him know it's no big deal... everyone has had that first really bad crime scene moment and that, with time, you'll realize this is clean compare to some of your later cases.