I'm afraid you misremember. The individual polls were all over the place, and the aggregate numbers were close to dead even, well within the margin of error of the actual result.
https://en.wikipedia.org/wiki/Opini...dom_European_Union_membership_referendum#2016
It should also be noted that UK polling is significantly worse than US presidential polling, with both methodological problems, and a far worse track record. Add a unique vote such as the EU referendum, and it adds a lot of uncertainity that isn't there in more usual races. Even so, the final poll aggregate numbers were close as hell, and leave won by less than two percent.
TL;DR Even with low-quality polls describing a situation with little precedent, Brexit isn't an example of polls failing, but of them working rather well.