I infer from the original post that the pirate would keep the key regardless of its current usefulness......
I think the first guy should ship himself in the unlocked chest while he holds on to the key....then when the pirate opens the chest, he can throw the lock at him, striking the pirate in the head, commandeer the ship and sail over to hang out with the other stranded guy.
If I come up with a better solution I'll be sure to post it.
b