From my understanding of the details of the situation, the editor is not acting well in refusing to pass along your invitation to the referee. Doing so does not violate anonymity in any way (I am confident that the review process was not "double blind" -- i.e., the referee knows the author's identity -- in my experience, no mathematics papers are reviewed in this way.) Maybe what the editor is thinking is that in order to accept your offer the referee would have to violate anonymity.
However, is this an ethical issue? I have always held it to be the case that a referee can disclose her identity to an author at any time, and I have done this more than once as a referee. I can vaguely see some ethical problems which might arise if this process of referee-self-disclosure were very widespread, but it seems like a bit of a stretch. I would be very interested if someone can explain to me why this is a real concern.
Against the highly nebulous previous paragraph one must balance the ethical issue that academic ideas are not gifts that one person can freely bestow upon another. I wrote the previous sentence in full awareness of the fact that mathematics in practice does have some degree of noblesse oblige: one often encounters very eminent and senior mathematicians giving ideas away to younger / less experienced / less eminent mathematicians without wanting anything in return: in mathematics we are inculcated to have a view that certain contributions are "below our level" and thus not worth taking credit for. That is fine if "not taking credit" means not becoming an author on a paper. But if it means not disclosing your contribution at all -- with the consequence that the begifted junior mathematician gets "too much credit" for work that had a significant component that was not his own -- well, that is hardly a victimless crime in our current highly competitive job-market. In fact it seems to be a form of plagiarism.
[The situation brings to mind Karl Iagnemma's short story "Zilkowski's Theorem". This was anthologized in the Best American Short Stories of 2002. Remarkably, this was only one of two short stories in that anthology in which the main character was a practitioner of the mathematical sciences. The other is Leonard Michaels's "Nachmann from Los Angeles". Both were excellent!]
Perhaps you should write back to the editor to express these ethical concerns. Getting the editor-in-chief of the journal involved (if this is not already the editor you are dealing with) is also a good idea at this point.
If you really don't know the identity of the author, then you need to indicate clearly the circumstances in whatever paper you write. You may also want to make it known in your circles that you would very much like to know the identity of the mathematician who helped you write your next paper. Depending upon how small / tightly knit your particular subcommunity is, you may have more or less luck with that, but it's certainly worth a try.