Also, for U.S. folks: having been in a psyche hospital is not in itself a barrier to gun ownership. HIPAA is extremely strict about who can share your medical records and when they can do so. I suppose if the government were very worried you were a terrorist there might be a path to subpoenaing your medical records, but otherwise there's no reason for them to know. If the hospital suspects that you're a danger to yourself or others, their job isn't to ring up the ATF. They just don't let you out in the first place.
What can trip you up is if you've been formally committed by a judge. That's a matter of public record. It can screw with you in multiple ways, too … you likely won't ever be able to get a security clearance, so some careers are closed to you. A commitment proceeding in which you lost can also be used as a reason to deny you custody of your children.
It doesn't count if your family guilt trips, threatens, or otherwise emotionally manipulates you going into the hospital. It doesn't even really matter if the docs in the ER decided to put you on a 72 hour hold without your consent. They will typically come back the next day or so and try to get you to sign yourself in voluntarily. It's easier on everyone if you do.
It's only "game over" time after you sit down in front of that judge, contest your commitment to the facility you're in, and s/he says "Too bad that you don't like it. You have to stay." Then you're fucked. There's little you can do at that point. If you can afford to hire an attorney, you have a greater chance of successfully challenging the commitment, but you're likely to be long out by the time all the proper paperwork has been filed.
My advice is to always, ALWAYS cooperate with the hospital staff to the greatest extent possible. You really don't want your mental illness and general weirdnesses to become part of a court record. Well, at least I don't want MY weirdnesses documented that way.
Edit: Relatives going to the cops & begging them to deny your permit application is indeed a problem. It is something you can contest, since revoking someone's constitutional rights is a very serious thing. Again, I'd recommend a lawyer. Also, if asked, I would stress that you're not currently acutely suicidal. People who are intermittently suicidal can definitely own weapons. What everyone is worried about is you punching your own ticket soon and impulsively.