The question is not so much whether you do as you're told by your subordinate but how you handle the "disagree-but-commit" state.
Ideally, the way it should work would be for the boss to say: "Okay, I think the right course of action is X, you think it's Y. We're in disagreement, but because I'm the boss, we'll do X. As you go about doing X, I won't intrude on your sphere of autonomy but will instead trust that you're a professional and will execute on X faithfully. If you frequently disagree with me and you're up for a promotion, I won't hold the disagreements against you. It might even work in your advantage, because we need to increase diversity of thought in management, rather than filling management roles with yes-men."
The way it usually works, in my experience, is: "I want you to do X, but you think you should be doing Y. That makes you a risk, because there's a danger you will sabotage X and execute on Y instead. I'll subject you to extra-close supervision to counteract that risk. When you're up for a promotion and you frequently disagree with me, I will fight your promotion, because if we increase your level of influence, it'll create more work for me, because I'll have to double-check your judgment and countermand your actions as a manager whereever I disagree. Having people in management who aren't yes-men just makes management more work, and we don't need that."
If your boss is of the latter kind and you disagree with them, then it's a mistake for you to ever "show your hand" to them by telling them about it. It's then better to just keep your mouth shut, and do as you're told. -- And this "shut your mouth and do as you're told" is my career advice for young people. This makes me look bad, and reflects poorly on the companies I've worked for. But that's the difference between career advice and hagiography.