The palace said a combination of “age, climate change and penetration from rainfall” had led to the declining state of the roof, attic timbers and ceilings.
Work on the roof and paintings is running concurrently, which the palace described as the “most ambitious undertaking” in its history.
The BBC was shown water damage to the Thornhill painting’s surrounding stonework being painstakingly cleaned by conservators.
Kelly O’Driscoll, head of Built Heritage at Blenheim Palace, said the painting had been damaged by years of dirt and water ingress.
“We could end up losing this painting… it’s a race against time to get it looked after”, she said.