Metaphor has a fairly specific definition; it is a type of analogy. An analogy is a type of association.
As mentioned, I think it's fair to say that all thought is based on associations. But it isn't true that all thought is analogies or metaphors.
There are simply other types of associations. I would call this case a "generalization", an extremely common thought process in mathematics, and an example of a kind of analogy (not a metaphor) where the original domain is a proper subset the new one.
In other words, applying an idea from one domain to another is an analogy, not necessarily a metaphor. To claim otherwise is just being loose with words in a way that has no meaning.
Euler's Identity isn't itself the metaphor, it's the equation we use to teach and understand it that is metaphorical. The letters themselves only mean "Euler's Identity" when imbued with the extra meanings that come from the symbolic framework of mathematics.
So we have to deal with them as pure sequences of signs which are part of the set of deducible formulas.
Your "understanding" (or mine or Euler's) of the formula is most likely a metaphor (well I'd say an analogy in this case) and is what led to its proof.
Gee, I think that extending the power series for e^x to the complex domain is a pretty fair interpretation of `metaphor' in the context.