Online polls in particular showed "Leave" was the favorite. People who thought Brexit was a clear favorite were only the pundits and betting market.
Also, the difference between Brexit and General Election is that one is a referendum and has many more swing voters that vote based on mood.
Conservatives outperform on referendum or propositions for whatever reasons. Brexit is closer to Prop 8 than it is to General Elections.
Also different composition of electorate, fact that the UK consists of four states (so to speak) rather than fifty, we weren't voting for a personality, long history of difficult relationship with EU, class issues which even outweigh those in the States, polling in this country isn't as good, etc, etc, etc, there are just so many differences that the analogy doesn't start to stand up.
Nate Silver also badly missed on Conservatives and Labour seats.
I don't know UK at all but it appears that UK is a harder place to poll or their data breakdown needs to improve.