In 1642, at the beginning of the English Civil War, the Irish Royalist Daniel O'Neill escaped from the Tower of London where he had been imprisoned by the Parliamentarians by
tying bed sheets and a tablecloth together and dressing as a woman
Also, according to the ballad Gude Wallace, William Wallace evaded capture by dressing as a woman. Probably more historically reliable is the case of Bonnie Prince Charlie who avoided capture disguised as Flora McDonald's maid in 1746. Then there is the case of Catalina de Erauso, a Spanish woman who escaped from a convent dressed as a man in 1600.
None of these qualify, though, as all are either post medieval and / or not escapes from captivity (although one might argue a case about escaping from a convent).
Are there any documented cases of anyone in Ancient or Medieval times successfully escaping from captivity by cross-dressing?
By 'escape from captivity', I am specifically excluding cases of avoiding capture. I'm only interested in cases where someone was already being held captive, preferably in a prison or cell.