$\def\p{\mathfrak{p}}
\def\Deg{\operatorname{Deg}}
\def\Z{\mathbb{Z}}
$I found a direct proof for a $\mathbb{Z}$-graded ring. Following this, since my proof is direct, whereas Ted's one is by contrapositive, I will post it here in case it's useful for anyone, as this post seems to have had a lot of visits.
Let $A$ be a $\mathbb{Z}$-graded ring. For $f\in A$, decompose $f=\sum_{i\in\Z} f_i$ into its homogeneous components and define the set
$$
\Deg f=\{i\in\Z\mid f_i\neq 0\}
$$
of non-vanishing degrees of $f$. Define the length of $f$ as
$$
\ell(f)=\max(\Deg f)-\min(\Deg f).
$$
Let $\p\subset A$ be an ideal such that for all homogeneous $f,g\in A$ with $fg\in\p$, we have $f\in\p$ or $g\in\p$. We show that $\p$ must be prime. Suppose then $f,g\in A$ are arbitrary elements such that $fg\in\p$. We show $f\in\p$ or $g\in\p$ by induction on $\ell=\ell(f)+\ell(g)$. Case $\ell=0$ means that $f,g$ must be homogeneous, so the assertion follows from the assumption. Let now $\ell>0$ and suppose the result true for all values strictly less than $\ell$. Denote
\begin{align*}
m_1=\min(\Deg f),\qquad\quad&\ell_1=\ell(f),\\
m_2=\min(\Deg g),\qquad\quad&\ell_2=\ell(g),
\end{align*}
and write
\begin{align*}
f=\sum_{i=m_1}^{m_1+\ell_1}f_i,\qquad\quad
g=\sum_{i=m_2}^{m_2+\ell_2}g_i.
\end{align*}
Then
$$
I\ni fg=\sum_{i=m_1+m_2}^{m_1+m_2+\ell_1+\ell_2}\sum_{j+k=i}f_jg_k.
$$
Since $I$ is homogeneous, the $m_1+m_2$ homogeneous component of $fg$ falls inside $I$, i.e., $f_{m_1}g_{m_2}\in I$. By the assumption and without loss of generality, we have $f_{m_1}\in I$. If we define $f'=f-f_{m_1}$, then $\ell(f')+\ell(g)<\ell(f)+\ell(g)=\ell$ and
$$
f'g=fg-f_{m_1}g\in I.
$$
Hence, by the induction hypothesis, $f'\in I$ or $g\in I$. If it were the former, this would imply $f=f'+f_{m_1}\in I$.