Incorrect reasons for rejection, what next?
Ok—Your paper was rejected because a reviewer made a mistake. I'll use my powers of Bayesian Induction to guess the editor just defaults to this reviewer, and there's not academic fraud issue. Everyone in academia has a drawer in their desk of decent papers that didn't get published just because.
You already emailed your advisor. You took the first step. That's good. I hope you didn't imply the editor's against you, but if you did, so be it.
Here's what you should you do now:
Go into the bathroom, take a deep breath, look in the mirror, and say: "this is going to be OK." Good papers get initially rejected for stupid reasons all the time.
Show the statement of the theorem, the purported counterexample, and your one-sentence refutation to your advisor or another colleague and get their reaction, to check whether you might have misunderstood the issue.
Did the editor communicate directly with you? How did they communicate with you? If it was by email, write an email back. Write a three-sentence email about why the reviewer's counterexample isn't a counterexample. Show your proposed email to your advisor for feedback before sending it to the editor.
You will wait to get a yes-no answer.
If you still get rejected, submit the paper to another journal.
If all else fails, put the paper up on arxiv and try to present it at a conference.
When you are writing a paper, your task is not to prove something. It is to communicate to others that you have proven it. If you make some theoretical mistake in your paper, that's your problem and you should correct it. If you write a paper which does not communicate your results well enough and misleads your readers to false conclusions, this is also your mistake, and it is your job to correct it.
And yes, writing is hard. We love to jot down our train of thought in the way which makes most sense to us, and then we expect that others will understand. In reality, a good paper tailors its writing to the readers. The best authors design their text as a track for the reader's train of thoughts, knowing the possible junctions of misunderstanding and gently leading the reader away from them.
The average author, and sometimes even the best author, cannot write a perfect text from scratch. Readers will misunderstand things every now and then. And a reviewer is a very thorough reader. If your reviewer misunderstands something in your paper, then it is likely that a large swath of later readers (who don't try to follow your text anywhere as closely) will misunderstand it in the same way. This is a major flaw in your paper, and has to be fixed. Luckily, such fixes are very easy with a bit of thought.
In your case, the problem is obviously that the assumption you made was not salient at the time the reader reached your proof. You have to change that. For example, in the place where you list your assumptions, add a sentence or two discussing why the assumption was made and what are its consequences. It will force the reader to think about the assumption and notice it, and keep it in mind for the rest of the paper. Should he think of his counterexample later, he will notice himself that it is not a counterexample, as long as it is obvious how it hurts the assumption. If it is not obvious, it is a good idea to discuss (somewhere after the proof) how examples of this type are not counterexamples, because there is a twist which makes them hurt your assumption.
After the paper has been corrected in this way, you can decide whether to resubmit to the same journal (point out to the editor that it was a misunderstanding and you have made changes to the text to clarify the point) or to another venue.
When a paper is rejected, do not argue about it. Submit to another journal.
If the paper is really good, it is the loss of the rejecting journal.
The loss to you of publishing in a less-important journal is minuscule compared to the aggravation you suffer by arguing and worrying about a rejection.
If (over time) you become known to editors as an argumentative submitter, it will only count against you.
I remember many years ago, the professor in the office next to mine was an editor on a major journal. He once remarked that the most unpleasant part of that duty was arguments received from authors of rejected papers.