Doctor Who: 13 Cool Details In David Tennant & John Barrowman's Last Of The Time Lords Commentary
10. Martha's Interior Scenes Were The Last Scenes To Be Filmed
Roughly ten minutes into the episode, Martha (along with Thomas Milligan) arrives at Professor Docherty's facility, kicking off a plot which eventually sees Docherty betray Martha and give her up to the Master. Bit rude.
There are a few scenes set inside Docherty's facility scattered throughout the episode, and according to Agyeman, these were all shot during the last few days of production.
Whether they were always planned to be the last days - or whether they were bumped there due to that aforementioned Teague/Harper switcheroo - she doesn't say.