The Goshawk is fictional, but the story is rooted in the complex and often contentious alliance between the Spanish guerrilleros and the British army in the Peninsular War. The Spanish Bourbon monarchy was notoriously corrupt and repressive. Many progressive Spaniards supported Joseph Bonaparte's government as the quickest route to reform, while others opposed the French occupation but wanted a new constitution. People in both groups were furious with the Bourbon restoration, which the British supported. By 1819, a new rebellion was brewing.
The capital punishment bill Malcolm and Rupert are mustering support for in the opening scene is inspired by the work of Sir James Mackintosh, a Whig MP, lawyer, philosopher, and historian. On 2 March 1819, Mackintosh moved for a select committee to inquire into capital punishment for felonies and carried the motion against the government by a majority of nineteen. In 1820, he introduced six bills based on the committee's recommendations. Three of them became law.
In the autumn of 1819, Emily Cowper and Harry Palmerston's enduring but far from exclusive relationship was indeed recovering from Emily's entanglement with Count Giuliano, to which Mélanie refers in the book, though I have moved the timeline up a bit. Emily did not return to town from an extended stay in the country until a bit later in the autumn. In September, she would indeed have been about three months pregnant with her youngest child, Fanny, born in February 1820. Palmerston was likely Fanny's father and also the father of two of Emily's other children.
War office records were a tangle that Palmerston devoted considerable energy to improving. He also was constantly answering questions in the House from his own party and the Opposition about military funding. For further reading about Emily and Palmerston and his work at the war office, I recommend Mabel Airlie's Lady Palmerston and Her Times (London: Hodder and Stroughton, 1922); Kenneth Bourne's Palmerston: The Early Years 1784-1841 (New York: Macmillan, 1982); and Tresham Lever's The Letters of Lady Palmerston: Selected and Edited from the Originals at Broadlands and Elsewhere (London: John Murray, 1957).