I was fired for "sexual harassment"

This is not a AITAH situation please do not respond as tho it is this is a legal advice sub treat it as such

I recently was terminated for "sexual harassment" let me explain. I was friends with the person who reported me and was the reason they were working at the job at the time. I made a joke one day that I've said to many other coworkers without issue. Apparently it was not well received. But because I was extremely sleep deprived to the ponit of chronic sleep deprivation(which can cuz a multitude of problems) I was unable to react according to being told to stop making certain comments. Which I have had no problem with in the past with another coworker as well as having a video of me complying to being requested to stop(was not about sexual comments at the time). I feel horrible for how I treated someone I viewed as a friend. They filed a HR complaint within reason. And HR talked to me about the situation but because of the sleep deprivation I had that day I didn't remember what had happened at all that morning and was only told about it after they fired me.

I feel like HR could have handles this very differently. I'm not saying I wasn't in the wrong but I feel like firing me for only this one instance is unjust. And wondering if I have any rights to sue for wrongfully termination?

Might I add the day they suspended me for the investigation I got injured at work and had to file for workman's comp and maybe that why they chose to fire me?

Edit: here is somethings about sleep deprivation for those who don't want to look it up: Sleep deprivation can lead to a range of negative side effects including: difficulty concentrating, impaired memory, mood swings, irritability, decreased motivation, increased risk of accidents, poor decision-making, fatigue, headaches, weakened immune system, increased appetite, higher risk of developing chronic health conditions