It very much depends on your position.
Are you paid for doing as you are told? Do as you are told.
Are you paid for knowing what you are doing (including knowing better than your boss)? You better know what you are doing and tell the boss what should be done.
(Obviously everything depends on circumstances. Don't tell the boss in front of customers, or in front of his boss. And don't do as you are told if it is obviously an expensive or dangerous mistake. And if your boss is often confused, you need to manage that).
Re-reading your question, it seems the bosses order wasted three hours of your time and left a customer waiting, so that would fall under "expensive mistake". If the boss reacts badly to being told about even expensive mistakes, then do whatever you can to make the bad consequences his problem, not yours.