£300 for just the valve sounds rather high, but there are a lot of variables to consider.
If it's a generic solenoid-operated valve which is fitted in the gas line as a separate device, then I would exect to be able to obtain a replacement for much less than than that (try £30 instead of £300). If the boiler design is such that the valve is an integral part of the burner assembly, then it will need to be the specific valve for that unit, and the price will go up accordingly, especially if it's an older, out-of-production model for which spares are now being made in only small quantities. Unfortunately, the manufacturers of these model-specific spares pretty much have customers over a barrel, since they are the only source of the component.
As for the cost of installing a complete new heating system, it's very hard to say whether £5000 is excessive or not without knowing what's involved. Obviously the boiler size, number and size of radiators, length of plumbing runs, etc. have an effect, but the labor costs are a huge chunk of the total, and can vary drastically depending upon the building -- Whether stone/brick or frame, single- or two-story, the overall layout, ease of access to attics, and so on.