How to help a mentally ill ex-boyfriend?

This is gonna be long, so thanks for any answers I receive. Now, I'll start by saying that I am not a bad person, but I have made a lot of fucked up choices over the past year. Please try to reserve your judgment until the end.

Last summer it all began, I was a happily married woman with a one year old perfect baby. My husband had become addicted to sex, unbeknownst to me. He became sexually abusive, manipulative, and cruel. Neither of us realized how far it has escalated until it all blew up. We started trying for a baby in July, and my husband would use it against me, "I guess we just won't get pregnant then. That's your fault" etc. I did fall pregnant in September/October and had a very early mc at 3w6d and it broke me. My husband did not understand my grief which set us even further apart. He asked for sex while I was curled up in pain from the mc and then ignored me to play video games. I was in a play at that time that I had to kiss another guy and we became friends. He was obviously struggling with his college school load, his parents were abusive, etc., and I fell for him. It made no sense, he was four years younger than I am, and obviously I was married. I ignored it until things with my husband escalated and I broke down. I completely shut down mentally and gave up. The other guy did tell me that he was in love with me, and we flirted, and admitted our feelings for one another. My husband found out about our emotional affair and we broke up. I was then alone with a one year old, managing the house by myself, and struggling to function fully. The guy I was seeing started staying with me, helping financially, etc. A few months into our relationship the inconsistencies piled up and I discovered the lies from this guy. He suffers from borderline personality disorder, crippling abuse from his family, and classmates from childhood. He lied to make himself better; more sexual partners, longer conquests, more money than he had, etc. We broke up in April and he threatened suicide, he cut himself repeatedly, he would call me at all hours of the night, etc. I was terrified of what he would do to himself because I did, and still do love him in many ways. I've stayed his friend as much as I can because of my fears. He has showed up outside of my house at 1am, torn down my curtain rods because my husband installed them, and called me awful names; and, yet, I still care and worry about his well-being, and my own and my husband's. He has, in a fit of rage, threatened my husband's life, and said that he would kill my husband, and then kill himself. I had my husband call the police and he was voluntarily hospitalized overnight for suicidal ideation. He has refused therapy since then, has no health insurance since his parents kicked him off so he can't be prescribed anything, and has dealt with his parents telling him that he should have just killed himself to spare the family the shame of a mentally ill son. He has no support system, no good friends, and I think I'm genuinely the first person to actually be there for him.

Now, here comes the confusing part. My husband and I have rekindled our relationship after many, many conversations, dealing with past issues, and we are not the same people we were. We are still working through the past, but here's the kicker - I'm 10 weeks pregnant. I have been hiding it from my ex who tends to show up at my house whether invited or not, and I'm getting ready to tell him soon. I'm not sure how to handle this, how to make sure he doesn't hurt himself, or hurt my husband. I know my life is a shitty soap opera, but I just want to get everyone out of this alive frankly.

You can judge my choices, god knows I do.