The Laird o Logie
The Laird O Logie or The Laird Of Logie is Child ballad number 182.
Synopsis
Young Logie (or Ochiltrie) is imprisoned, to hang. May Margaret comes to court to plead for his life. She is unable to win a pardon but steals some token or a forged pardon (and sometimes a weapon), sometimes with the queen's aid. With these, she frees Young Logie—the man she loves, or the father of her baby, depending on the variant.
Commentary
This is based on historical events. The king is James VI of Scotland and Young Logie is John Wemyss, the Laird of Logie in North Fife. The offense for which he was imprisoned—unlike the stolen kiss claimed in some variants—was involvement with the Earl of Bothwell in an attempt to kidnap the king. Lady Margaret was a queen's servant and did succeed in rescuing him, and they later married.