So this is in the interest of storytelling and writing.
So we have cop A who is undercover and acting as mobster B's right hand man.
Then we have bar owner C who closed down the bar, and is alone in it doing inventory 2 hours after closing, all alone.
B and A come in the bar (forcibly, since it was closed, but quietly) and surprise C. B want to threaten C into paying protection money, but C refuses, so B and A (who is undercover) are trashing the place and threatening C with death.
C then quickly pulls out a gun and shoots both of them dead.
Would C be in any trouble? Seeing as how it was self defense and he didn't know that A was an undercover cop.