Your proof does indeed work (with a few minor corrections to your definition of $\zeta_{\mathbb Z[i]}$), and whilst it is not the easiest way to prove that $\mathbb Z[i]$ has infinitely many primes (see the other answer), the proof works in a much more general setting:
Theorem: Let $K$ be a number field and $\mathcal O_K$ be its ring of integers. Then $\mathcal O_K$ has infinitely many prime ideals.
The proof is exactly the same as the proof in your question. Define the Dedekind zeta function
$$\zeta_K(s) = \sum_{0\ne\mathfrak a \subset \mathcal O_K}N\mathfrak a^{-s},$$where $s\in \mathbb C$, the summation is over non-zero ideals of $\mathcal O_K$, and the norm of an ideal is defined by $$N\mathfrak a = \#\mathcal O_K/\mathfrak a.$$
Equivalently, $$\zeta_K(s) =\sum_{n=1}^\infty a_nn^{-s}$$
where $a_n=\#\{\mathfrak a \subset\mathcal O_K:N\mathfrak a =n\}$. When $K=\mathbb Q$ this is just the Riemann zeta function. When $K = \mathbb Q(i)$ as in your question, then we will have $a_n = 0$ whenever $n$ cannot be written as a sum of two squares. However, for example, when $(x+yi)$ and $(x-yi)$ are different ideals, we will have $a_{x^2+y^2}\ge2$, so this function is slightly different to your $\zeta_{\mathbb Z[i]}$.
This series converges absolutely in the half-plane $\mathrm{Re}(s)>1$ and has a simple pole at $s=1$.
Now $\mathcal O_K$ may not be a UFD. However, it will always be a Dedekind domain, so it will be the case that every ideal can be uniquely factorised as a product of prime ideals. It follows that we can write
$$\zeta_K(s) = \prod_{\mathfrak p\subset\mathcal O_K}(1-N\mathfrak p^{-s})^{-1}$$where the product is over prime ideals, converges absolutely for $\mathrm{Re}(s)>1$ and has a simple pole at $s=1$. Your proof now applies.
Even further generalisation is possible. For example, by considering the Dirichlet characters$$\chi:(\mathbb Z/m\mathbb Z)^\times\to\mathbb C^\times$$and their corresponding L-functions
$$L(s,\chi) = \sum_{n=1}^\infty\chi(n)n^{-s}=\prod_p(1-\chi(p)p^{-s})^{-1}$$(and some amount of hard work), one can prove Dirichlet's Theorem on Primes in Arithmetic Progressions: that for any $a$ with $(a,m) = 1$, there are infinitely many primes $p$ with $p\equiv a \pmod m$.
One can go even further, and consider what an analogue of this theorem would be for a general number field. One quickly finds oneself playing with some of the ideas of Class Field Theory. For a good introduction to this approach, see (especially chapter 2 of) Class Field Theory by N. Childress.