There are two things going on here.
One is the form you signed when you purchased a firearm. The regulations are clear that the unlawful drug use applies to a period before and during the purchase. If the only evidence is that you tested positive two years after you signed the form, I doubt if you could be convicted of lying when you filled out the form. If it was two days after you filled out the form, the chances of being prosecuted and convicted increase. This is a federal crime and has nothing to do with the fact that you just shot someone - other than you probalby wouldn't have been tested otherwise.
Two is your plea of self defense. This is state law. That law does not cease to apply to you because you tested positive.
If there is some sort of law in your state where the local folks make you fill out a form and do a background check and you lied on it, that would be another law you may have violated. Again, it isn't going to change the law of justification.