He technically didn’t brainwash them into setting him free. He convinced the pirates to double his ransom and to let him walk free around the camp, where he often and loudly told them that he would come back and have them all killed, once his ransom was paid and they let him go. Then he did exactly that.
DLC