There is a concept called malicious compliance in the secular world. A typical example would be when your boss is in a bad mood, and has a go at you for a mistake and says you are no longer allowed to conduct that operation anymore. They haven't thought it through, and if you were to really follow their instructions, it would damage the business.
In the secular world, it is often considered a triumph when the person actually follows the bosses instructions to the letter, and watch them get fired / the business burn, and nobody can "blame" them because they "were only following instructions".
This is clearly forbidden in halacha. What would be the correct approach to genuine situations where the boss is being unreasonable, stubborn and threatening, but you know they are wrong and you just want to follow halacha and not do something you know is of damage to them or the business? To what extent should they accept personal consequences for this?