Up to 40,000 people will receive a refund thanks to a Romford “hero” after he discovered that the government have wrongly assessed who is liable for the bedroom tax.

A conservative estimate puts the cost to the government at £26million.

Peter Barker, a freelance benefits specialist, of Hillfoot Avenue, discovered the loophole in December but last week the Department for Work and Pensions confirmed his analysis.

By his estimations, up to 90 tenants in Havering could be eligible for an average refund of £770.

It has also been reported that the suicide of the woman from Solihull who, in a note, blamed her death on the financial strains aggravated by the bedroom tax would have been exempt and, if she was still alive, eligible for a refund.

Mr Barker, 53, spotted the oversight made by the DWP in legislation they drafted in 1996. Housing benefit regulations from 1996 were not updated when the coalition created the bedroom tax.

He said: “I just put my findings onto an online discussion forum. I just expected people to find it interesting but instead in went viral.

“There was such a twitter storm over this. Until December I had just one follower and that was my sister-in-law. Now I’ve got people contacting on me on there hailing me as a hero.”

He explained that the area of legislation had become far to overcomplicated and described it as “an accident waiting to happen”.

The bedroom tax sees working age council and housing association tenants with spare bedrooms lose up to 25 per cent of their housing benefits.

It affected 660,000 claimants meaning they either had to move homes, find a way to pay the deficit or downsize to a smaller property.