The episode, which had a profound effect on Sir Edward, took place when he was a major in the Royal Artillery in Germany at the end of the war. It is related for the first time in A Very Singular Man, a television portrait by Michael Cockerell.
The former prime minister says in the film: "The Polish man was taken outside by the guards and tied up and blindfolded, and then the firing squad marched out and I gave the orders for them to fire.
"I obviously felt uneasy. It's one thing to be in the war, and you see the enemy on the other side and so you bombard them, and then later on when you pass over their ground, you see dead bodies lying around.
"That's one thing. That's war. But it's different when you have an individual. I didn't sleep particularly well that night."
The documentary, to be broadcast on BBC2 on Sunday evening, also reveals that senior Conservatives tried to marry off Sir Edward when he was prime minister because they felt that his bachelor status made him appear remote and out of touch.
The bride whom they had in mind was Dame Moura Lympany, a concert pianist who regularly visited Downing Street and Chequers while he was in office from 1970-74. He was an accomplished pianist and conductor, and the two played in concerts together.
Dame Moura, now 82, like Sir Edward, tells Mr Cockerell that she received a visit from the late Sir Tufton Beamish, a member of the executive of the 1922 Committee. "Tufton came to see me at my house and said, `Ted must get married, will you marry him?' " she says. "Well, I would have regarded it as a great honour if Ted had asked me to marry him."
Asked whether she would have accepted, she says: "Ah, if I hadn't been in love with somebody else."
Sir Edward, who has never married, tells Mr Cockerell: "I liked Moura and apparently she liked me. We had an interest in food and wine and in discussing musical performances."
When he is shown footage of Dame Moura describing Sir Tufton's visit, Sir Edward's eyes light up. He says: "Tufton never discussed it with me, but nothing surprises me anymore." Gallantly, he declines to say whether he would have married her.
Sir Edward, who is still an MP, joined the Royal Artillery as a gunner at the beginning of the war, and ended his military career as a colonel in Germany in 1946.
A friend, Lord Healey, a former Labour Chancellor, says he was "enormously changed" by his experiences as a gunner.
"He had a toughness which had not been actually visible - I don't say he didn't have it - before the war, but it was very visible after the war," he says.Reuse content