Your problem, as we resolved in the comments, is that $(0)$ is not prime. In fact, after localization $(0)=(2)$. Let's generalize: we shall determine when two ideals of a certain class of rings (including all quotients $\mathbb Z/n\mathbb Z$ for $n\ne 0$) are equal after localization.
Given a multiplicatively closed set $S\subset R$, the set $\{r\in R:rs=0\text{ for some } s\in S\}$ is an ideal, which we will call $S^{\bot}$.
Our general theorem is,
Theorem. If $R$ is a commutative ring with unity such that every prime ideal is maximal, then $S^{-1}R\cong R/S^{\bot}$ for any multiplicatively closed set $S$.
In particular, if $I$ and $J$ are ideals of $R$, then $S^{-1}I=S^{-1}J$ if and only if $I+S^{\bot}=J+S^{\bot}$.
In the case $R=\mathbb Z/(n)$, we can calculate the generator of pullback of the ideal $S^{\bot}$ to $\mathbb Z$. We shall call it $d$. Firstly, $S^{\bot}=\sum_{s\in S}\operatorname{ann}(s)$, since $S^{\bot}$ is simply the union of those annihilators. Second, if $rs=0$ in $\mathbb Z/(n)$, and $s\ne 0$, then $r's'=kn$ and $s'\ne 0$ for representatives $r',s'$ in $\mathbb Z$. So, $r'=kn/s'\in (n/\gcd(n,s'))$. Moreover, the converse, that $rs=0$ when $r'\in (n/\gcd(n,s'))$ for a pair of representatives $r',s'$ is clearly true. This means $\operatorname{ann}(s)$ is the image of $(n/\gcd(n,s'))$ in $\mathbb Z/(n)$. Thus, $S^{\bot}$ is the image of $$\sum_{s\in S}(n/\gcd(n,s'))=(\gcd_{s\in S}\{n/\gcd(n,s')\}).\tag{1}$$
Finally, the number $\gcd(n,s')$ is uniquely determined by $s$, so the generator of the ideal in $(1)$ is uniquely determined by the set $S$.
Let $I$ and $J$ be ideals of $\mathbb Z/(n)$. Let $(a)$ and $(b)$ be their respective pullbacks in $\mathbb Z$. Then, $S^{-1}I=S^{-1}J$ if and only if $(a)+(d)=(b)+(d)$ if and only if $\gcd(a,d)=\gcd(b,d)$.
Proof (Theorem). Let $R$ be such a ring. Since the minimal prime ideals of a commutative ring consist of zero divisors, the set of all units of $R$ is precisely the set of its non zero-divisors.
First, consider the case $S^{\bot}=0$. If $s\in S$ were a nonunit, then it would be a member of some ideal of $R$, so it would be a zero-divisor. If $rs=0$, though, then $r\in S^{\bot}$ implying $r=0$ which is a contradiction. Therefore, $S$ consists of units in this case, so $R/S^{\bot}=R=S^{-1}R$.
Now, return to the general case. Set $A=R/S^{\bot}$. Then, the canonical homomorphism $R\to S^{-1}R$ factors as $$R\xrightarrow{\phi} A\to S^{-1}R.$$ Define $\bar S=\phi(S)$. If $f:R\to R'$ is a ring homomorphism such that $f(s)$ is invertible for all $s\in S$, then there exists $\rho: S^{-1}R\to R'$ such that $f$ is the same as the composite $R\to S^{-1}R\to R'$. This determines a homomorphism $g: A\to R'$ such that $g\circ\phi=f$ and $g(\bar s)$ is invertible when $\bar s\in\bar S$. Use the universal property of localization to determine a map $h: \bar S^{-1}A\to R'$, where $R\to A\to \bar S^{-1}A\to R'$ is $f$. Note that $h$ is uniquely determined by $f$, since it is determined uniquely by $g$, which in turn is determined uniquely by $f$. Therefore, $\bar S^{-1}A\cong S^{-1}R$.
Finally, let's calculate $\bar S^{\bot}$. In $R$, if $rs\in S^{\bot}$ where $r\in R$ and $s\in S$, then $rss'=0$ for some $s'\in S$. Since $S$ is multiplicatively closed, it follows that $r\in S^{\bot}$. Hence, if $\phi(r)\phi(s)\in\bar S^{\bot}$, then $rs\in S^{\bot}$, so $\phi(r)\in\phi(S^{\bot})=0$. Hence, $\bar S^{\bot}=0$. We already resolved this case above, $\bar S^{\bot}A=A$. Therefore, $S^{-1}R\cong A$ q.e.d.