Otherwise, this happens.
Also, "raw emotion", direct democracy (in Switzerland, for example) can work very well. Direct democracy may not scale well, hence we need representation, but big issues should be left up to the people to be voted on.
In the end, I believe, the people in the UK voted against not so much the idea of EU, but rather expressed their frustration with the EU's inability (unwillingness?) to fix its problems. It's been brewing for a while.
But then thinking back to the US Constitution, it was voted in by the state legislatures without a direct vote, too. Somehow that seems OK back then, but an affront to democracy in today's world. How times change.
Why should something like this be any different?
But, on Brexit specifically, the British people elected a government that made a campaign promise to hold exactly such a referendum, and to abide by its results.