  Let $G$ be either a profinite or a connected compact group, and $\Gamma,
\Lambda$ be finitely generated dense subgroups. Assuming that the left
translation action of $\Gamma$ on $G$ is strongly ergodic, we prove that any
cocycle for the left-right translation action of $\Gamma\times\Lambda$ on $G$
with values in a countable group is virtually cohomologous to a group
homomorphism. Moreover, we prove that the same holds if $G$ is a (not
necessarily compact) connected simple Lie group provided that $\Lambda$
contains an infinite cyclic subgroup with compact closure. We derive several
applications to OE - and W$^*$- superrigidity. In particular, we obtain the
first examples of compact actions of $\mathbb F_2\times\mathbb F_2$ which are
W$^*$-superrigid.
