It all depends on state law. Generally, there is no such right. There are too many variables involved. For one, what's unlawful? How is that determined and who determines it?
I was thinking of situations where you have completely rogue officers-ie. that case in NY where the officers allegedly sexually assaulted a woman, or other situations where officers may break into the wrong home without identifying themselves as officers or break into a home looking to steal things or similar such actions.
EDIT: There was that 2007 case in Chicago where a drunk cop beat the **** out of a woman bartender who had refused to serve him. If she had gone for the 12 gauge under the counter, or someone else had would that have been justified?