Do what they say if either of these things is true:
1) It's a lawful order...and you'd better be sure about what is and what isn't.
2) They have a gun pointed at you and you are risking your life just to be right.
Also, if you KNOW it is an unlawful order (like they are going to arrest you for something you are allowed to do), comply, let them arrest you, and then, if they violated your Constitutional rights, their qualified immunity is gone, and you can sue them (even though the city or org they work for will likely pay), they will lose their jobs, etc. If I were in that situation, I would calmly warn them that they will lose their qualified immunity and that I will sue them before I would then turn around and let them handcuff me. I would definitely sue too, not because I need the money, but there is FAR TOO MUCH police misconduct (even if it's just due to ignorance) that this would need to happen.