A neighbor two units down from me discharged a firearm inside the unit and the bullet went through both of our units and ended up in mine. If either of us had been using the bathroom we may have been killed. Is there any legal action that we can take or anything that we can pursue?
Yes for the damage to your property, maybe for almost shooting you.
You could, of course, sue for the cost of repairing the damage caused to your property by your neighbor.
Whether you could also sue for negligent infliction of emotional distress is a bit more complicated. The relevant test in many jurisdictions is the "zone of danger rule", which requires that the plaintiff was
- "placed in immediate risk of physical harm" by the defendant's negligence
- frightened by the risk of harm.
The exact details vary by jurisdiction (more information here with some examples here, and many substantially restrict such claims, but in all jurisdictions that use this rule, you must at least be in immediate risk of physical harm. The second article I linked gives an example of someone in the back of a defective elevator being found to be outside the "zone of danger" due to not being close enough to the doors have sustained harm.
In your case, it's hard to know for sure how a court would rule, but your odds of prevailing on such a claim are substantially lower if the bullet did not pass fairly close to you. For instance, if you heard the sound and only upon investigating realized that a bullet had gone through the apartment, that would not count.