All that is true but we see Harry thoughts at the moment and he actually felt sorry for doing that to Carlos. So, even when Harry was pissed off with him he still thinks of Carlos as a friend and did not like to humiliate him. He did it because Thomas was in serious danger.
No, I don't think he liked humiliating him, but Carlos didn't treat him like a friend, did he? Putting the tracking spot on him, then allowing him to be "patted down" to see if he had sex lately, and then demanding who with? Carlos tells Harry to talk to him, like we're friends, but he doesn't treat him
at all like a friend. So yes, Harry did it because it was the only way to spring Thomas is true. However at the same time I cannot fault Harry for wanting a little mild pay back.