I proved that in an integral domain that the implication always holds, but apparently it doesn't necessarily hold in all rings, and I have been looking for counterexamples. But, I'm confused why this proof that doesn't use the assumption of $R$ being an integral domain fails (and certainly it fails since I'm "proving" a false result):
Let $R$ be a ring, not necessarily an integral domain. Say $$ (a) = (b) $$ Thus, $a\in (b)$ and therefore $a = b\circ c$ for some $c\in R$.
Further, $b\in (a)$ and similarly $b = a\circ g$.
Thus, plugging in $b = a\circ g$, we get $a = a\circ g\circ c$. Hence, $g\circ c = 1$, so $g, c\in R^*$. Thus, letting $u = c$, we get $a = b\circ u$ for some unit $u$.
I'm unsure why this proof fails.
You indeed get that $a=agc$ for some $g,c\in R$. This does not imply $gc=1$. It does imply that $$a(gc-1)=0.$$ In an integral domain, this implies that either $a=0$ or $gc=1$. In a general commutative ring, it does not.
Note that this also shows that your proof fails for integral domains in case $a=0$. Of course this case is easily taken care of, as then $(b)=(a)=(0)$ and hence $b=0$, so $a=bu$ for any unit $u$.