Between pillar and post, there may be a rescue.
In very olden times, an innocent young person was mistakenly condemned to death. When he was taken to a special place and tied to a pillar, waiting for the order to be hanged. The hangman asked him, “Do you have any last wish?” After a moment, the convicted man said, “If it is no trouble for you, untie me from this post and bind to that one.” His wish was granted.
Between this displacement, the original criminal was recognized, and the judge ordered the accused to be freed. Since that time, the idiomatic phrase has been used by some people on various occasions.
~ Mary Farahnakian, Tehran, Iran