Consider an ideal $\mathfrak I$ which is not contained in any $\mathfrak{m}_p$. Thus, for every $p\in S^1$, there is some function $f\in\mathfrak I$ with $f(p)\ne0$. Such an $f$ is nonzero in a neighbourhood of $p$. Since $S^1$ is compact, you can find $f_1$, …, $f_n\in\mathfrak I$ so that the $n$ sets $\{p\in S^1\colon f_k(p)\ne0\}$ cover $S^1$. Thus $f_1^2+\cdots+f_n^2\in I$ has no zeros, so it is invertible in $\mathfrak I$. (In the complex case, use $\bar f_1f_1+\cdots+\bar f_nf_n$ instead.)
Edited to add: Now consider any proper, nonzero ideal $\mathfrak I$. Let $\{p_1,\ldots,p_n\}$ be the common zeros of $\mathfrak I$ (it is finite because analytic, nonzero functions only have isolated zeros). Let $e_k$ be the minimal order of any zero at $p_k$. Clearly $\mathfrak I\subseteq \mathfrak m_1^{e_1}\cdots\mathfrak m_n^{e_n}$.
Edit the second: To prove the opposite inclusion in the even case (i.e., $e_1+\cdots+e_n$ even), note that any function with a zero of order $e_k$ at $p_k$ for each $k$, and no other zeros, is a generator of $\mathfrak m_1^{e_1}\cdots\mathfrak m_n^{e_n}$. I only need to find a member of $\mathfrak I$ with this property. First, find some member $f\in\mathfrak I$ with a zero of exactly order $e_k$ at $p_k$ for each $k$, but possibly other zeros as well. (Taking linear combinations of functions $f_k\in\mathfrak I$ with a zero of order $e_k$ at $p_k$ will do for this.) Assume $p_1$, …, $p_k$ are listed in clockwise order around $S^1$, and add indices modulo $n$ where necessary. Use obvious interval notation like $[p_k,p_{k+1}]$ for arcs of $S^1$. $f$ must suffer an even number of sign changes around the circle. Since we consider the even case, that means the arcs $[p_k,p_{k+1}]$ in which $f$ has an odd number of sign changes must itself be even in number. Multiply $f$ by some function which has a single zero in the interior of each such arc, and no other zeros. For economy of notation, call the result $f$ once more. So now $f$ has an even number of sign changes in each arc $[p_k,p_{k+1}]$. Moreover, the new $f$ has a sign change at an even number of the $p_k$. Pick a function $h\in C^\omega(S^1)$ with a single zero at each of those $p_k$ and no other zeros; negate it if necessary so that $f$ and $h$ have the same sign in a neighbourhood of each $p_k$.
Next, pick a function $g\in\mathfrak I$ which is positive in every open arc $(p_k,p_{k+1})$. (To do this, start by squaring any member of $\mathfrak I$. It has only a finite number of zeros outside the $p_k$, and we can eliminate those by adding squares of more members of $\mathfrak I$ which don't vanish at those points.) If $M$ is large enough, then $f+Mgh\in\mathfrak I$ will have no zero other than the $p_k$. (Sign considerations guarantee this in a neighbourhood of each $p_k$, and $gh$ is bounded away from zero elsewhere.) This is the function sought, and the proof of the even case is complete (modulo details that I might explain in the comments if asked).
For the odd case, pick any $f\in \mathfrak m_1^{e_1}\cdots\mathfrak m_n^{e_n}$. Since it must have an even number of zeros (couning multiplicity), it must have zero $q\notin\{p_1,\ldots,p_n\}$, or it has a zero of order $>e_k$ in some $p_k$ (in which case we put $q=p_k$). Let $\mathfrak I'=\{f\in\mathfrak I\colon f(q)=0\}$ (with the obvious modification if $q=p_k$, that $f$ have a zero of order $<e_k$ at $p_k$). Now $\mathfrak I'=\mathfrak m_1^{e_1}\cdots\mathfrak m_n^{e_n}\mathfrak m_q$ by the even case, and $f$ belongs to the right hand side. Thus $f\in\mathfrak I'\subset\mathfrak I$.
The above was for the real case; I see no difficulty in adapting it to the complex case.
"$\Rightarrow$" If $\mathfrak p$ is minimal over $(a)$, then $\mathfrak p$ contains a prime element $p$ which appears in the decomposition of $a$ into primes. It follows that $\mathfrak p=(p)$.
"$\Leftarrow$" (I suppose that $R$ is an integral domain.) Use the Kaplansky's Theorem for UFDs: a domain is a UFD iff every nonzero prime ideal contains a nonzero prime. Let $\mathfrak q$ be a non-zero prime ideal, and $a\in\mathfrak q$, $a\ne 0$. Then there is $\mathfrak p$ a prime ideal contained in $\mathfrak q$ which is minimal over $(a)$. Since $\mathfrak p$ is principal, then it is generated by a prime element, so $\mathfrak q$ contains a nonzero prime.
Best Answer
(1) Send $X$ to $\cos$ and $Y$ to $\sin$. The kernel of this homomorphism consists from the polynomials $f\in\mathbb{R}[X,Y]$ with the property $f(\cos t,\sin t)=0$ for any $t\in\mathbb{R}$. Now prove that this implies $f$ divisible by $X^2+Y^2-1$: consider $f$ as a polynomial in $X$ with coefficients in $\mathbb{R}[Y]$ and write $f=(X^2+Y^2-1)g+r$, where $\deg_Xr\le 1$. Then $r=a+bX$, where $a,b\in\mathbb{R}[Y]$. From $f(\cos t,\sin t)=0$ for any $t\in\mathbb{R}$ we get that $r(\cos t,\sin t)=0$ for any $t\in\mathbb{R}$, that is, $a(\sin t)+b(\sin t)\cos t=0$ for any $t\in\mathbb{R}$. This gives us that $a^2(\sin t)=b^2(\sin t)(1-\sin^2t)$ for any $t\in\mathbb{R}$. But $a,b$ are polynomials and the last relation implies that $a^2(Y)=b^2(Y)(1-Y^2)$ and this is enough to deduce $a=b=0$ (why?).
(2) We show that $x$, the residue class of $X$ in $\mathbb{R}[X,Y]/(X^2+Y^2-1)$ is irreducible and does not divide $1+y$ and $1-y$, the residue classes of $1+Y$ and $1-Y$. (Note that in $\mathbb{R}[x,y]$ we have $x^2=(1+y)(1-y)$.)
Edit. If $x=z_1z_2$, then, by using (4) (see below) we get $N(x)=N(z_1)N(z_2)$ $\Leftrightarrow$ $Y^2-1=N(z_1)N(z_2)$. Now we have the following cases:
(i) $\deg N(z_1)=0\Leftrightarrow z_1\in\mathbb R^*$,
(ii) $\deg N(z_1)=2$ $\Leftrightarrow$ $\deg N(z_2)=0$ $\Leftrightarrow$ $z_2\in\mathbb R^*$,
(iii) $\deg N(z_1)=\deg N(z_2)=1$. If $N(z_1)=Y-1$, then $a_1^2(Y)+b_1^2(Y)(Y^2-1)=Y-1\Rightarrow Y-1\mid a_1(Y)\Rightarrow\exists a_2\in\mathbb R[Y]$ such that $a_1=(Y-1)a_2$ and pluggin this in the foregoing equation we get $a_2^2(Y)(Y-1)+b_1^2(Y)(Y+1)=1$. Looking now at the leading coefficients of $a_2$ and $b_1$ we find that one of these is zero (false!) or the sum of their square is zero (false!).
Assume that $x\mid 1-y$. Then $N(x)\mid N(1-y)\Leftrightarrow Y^2-1\mid (Y-1)^2$, a contradiction.
(3) I've proved here all you need for this part.
(4) As one can see from $(1)$ the elements of $\mathbb{R}[x,y]$ can be uniquely written as $a(y)+b(y)x$. Define a "norm" $N:\mathbb{R}[x,y]\to\mathbb{R}[Y]$ by $N(a(y)+b(y)x)=a^2(Y)+b^2(Y)(Y^2-1)$. $N$ is multiplicative and using this we get that the units of $\mathbb{R}[x,y]$ are the non-zero elements of $\mathbb{R}$.
For $\mathbb{C}[x,y]$ we can see, via the isomorphism from part $(3)$ that the invertible elements are the non-zero elements of $\mathbb{C}$, the powers of $x+iy$ and $x-iy$, and products of the non-zero elements of $\mathbb{C}$ with the powers of $x+iy$ and $x-iy$.