It is illegal to leave the gas installation in an unsafe state when selling. An example is someone who removes some appliance they are taking with them and don't cap off, but just turn off the gas leaving an open pipe end -- that's been known to happen.
However, this certainly doesn't mean you can claim the cost of a new boiler unless the house was sold as containing a new boiler. Deterining that the boiler needs replacing and negotiating any reduction is your responsibility before the sale -- too late afterwards. At best, you could try reclaiming the cost of making the gas installation safe (capping off the old boiler), but that's not going to be worth the effort.