What options do you have to retaliate (legally) when unlawfully harassed by police officers?

You can file a formal complaint with the department. You can consult an attorney depending on the type of harassment, situation, etc, to see if a lawsuit is an option.

Other than that? None really.