This aired on TCM just a couple weeks ago, I only caught a couple snippets of it since I was busy at the time and forgot to make note of the title. A German defected during WWII (or possibly WWI) and was trained by either Americans or British forces to pretend to be a German soldier. Eventually he went undercover - the scene I got to watch with the least distractions was when he was posing as a kind of surgical aid to an officer, the officer invited him to eat and drink with him before retiring to bed, when the spy went and studied some maps laid out on the table. And then the officer had a health scare in the middle of the night, and the spy had a chance to let him die but chose to keep his cover and saved him. Then in the morning he got sent out to the front lines and passed the hanged corpses of other outed spies.