Complex! It's times like this I have a twinge of regret about not continuing my tax accountancy career (25 years ago). This will be very tedious for most people but the completist in me felt compelled to go off and look into this.
If I've got it right, re-marriage is treated like this.
John dies, leaving half his estate to Mary. Half his IHT threshold is therefore unused and transferred to Mary, because anything you leave to your spouse is exempt from IHT.
Mary re-marries. Her new husband, Peter, sadly also dies a few years later. He leaves 25% of his estate to Mary. The unused 25% of Peter's IHT threshold also goes to Mary.
When Mary dies too, her IHT threshold is:
Her own threshold - £325k at present
The unused part of John's threshold - 50% of £325k (doesn't matter what it was at the time of John's death)
The unused part of Peter's threshold - 25% of £325k (ditto)
So her estate could be up to £568,750 before any IHT is payable.
The principle seems to be that no matter how many times you are widowed you can never end up with more than 200% of the IHT threshold - your own 100% and a maximum of 100% to reflect what was unused by your deceased spouses/civil partners in previous years.
So let's go back to the example above and tweak it to assume that Mary married a third time, to Carlos, who leaves her 50% of his estate.
So now the sums at Mary's death go like this:
Her own threshold - £325k at present
The unused part of John's threshold - 50% of £325k
The unused part of Peter's threshold - 25% of £325k
The unused part of Carlos's threshold - was 50% but Mary's estate can't end up with 125% of the IHT threshold, so it will be limited to 25% of £325k
Mary's estate could therefore be £650k before any IHT is payable.