My personal experience with suicidal ideation, and the period you go through where you know that you're a genuine risk to yourself, is that it's not a one time thing.
You'd like to keep a gun. That's fine, ordinarily. But to do that safely, it means that every single time you reach this point, you need to own up to your SO and arrange to get the gun out of harms way. And maybe you can do that this time. But what about if it happens again, and you go through a period where you feel like this again? Can you guarantee to yourself, and to your SO, that every single time this comes up, you'll be agoe to communicate that in time? IME, it gets harder each time to ask for help.
If that resonates, the gun needs to go. Period. And pencil in to revisit gun ownership when you've gone a couple of years without hitting rock bottom. Keeping the gun, even temporarily locked away, is keeping the option open. Don't do that to yourself, it's too hard.