Where did the phrase "That will do the trick" come from? It's affirmative statement after the completion of job. "There, that will do the trick." he said proudly after fixing his truck.
I have a suspicion that it is in some part correlated with the term "trick" that a prostitute used to refer to her clients. To "do the trick" would indeed be getting the job done.