Non-trivial example of $H^2(G,M)$ where $M$ is a non-trivial G-representation Let $G$ be a finite group; denote by $\mathbb{Z}_2$ the cyclic group of order $2$.
Let $\pi: G \rightarrow \mathbb{Z}_2$ be a non-trivial group homomorphism.
Let M be the $G$ representation $\mathbb{Z}_2 \times \mathbb{Z}_2$ with action given by
\begin{align}
g[(a,b)] = 
\begin{cases}
(a,b)& \quad \text{if $\pi(g) = 0$}\\
(b,a)& \quad \text{if $\pi(g) = 1$}.
\end{cases}
\end{align}
Let
\begin{align}
f: M &\rightarrow \mathbb{Z}_2\\
f(a,b) & \mapsto a+b
\end{align}
$f$ maps a 2-cocycle in $Z^2(G,M)$ to a 2-coycle in $Z^2(G,\mathbb{Z}_2)$. I want an example where the image of $f$ is not a coboundary.
Examples I have checked:
$H^2(\mathbb{Z}_2, M) = 0$ for $\pi = \text{id}$.
I have also checked numerically that $H^2(\mathbb{Z}_2 \times \mathbb{Z}_2, M)$ for $\pi(a,b) = a+b$ and $\pi(a,b)=a$ also only have images that are coboundaries under $f$.
 A: Here is a new attempt at an example. I prefer to denote the $1$-dimensional module for $G$ over the field of order $2$ with trivial action by $T$ rather than by ${\mathbb Z}_2$, which is used with too many different meanings.
So now we are just looking for an example in which the induced map $H^2(G,M) \to H^2(G,T)$ is nonzero
Let $G = C_4 \times C_2$ be the direct product of cyclic groups of orders $4$ and $2$, with the direct factors generated by elements $g$ and $h$, and define $\pi$ by $\pi(g) = 1$ and $\pi(h) = 0$.
I prefer to describe the example in terms of group extensions rather than cocycles, but I can calculate a corresponding $2$-cocycle if you like.
Consider the group defined by the following presentation. (I am putting it in Magma format for ease of cutting and pasting.)
E := Group< g, h, a, b | g^4=a*b, h^2=a^2=b^2=1, a^g=b, b^g=a,
                         a^h=a, b^h=b, a*b=b*a, h^g=h*a >;

You can check by computer that $|E|=32$ (it is $\mathtt{SmallGroup}(32,7))$, and you can see directly from the presentation that it is an extension of $M$ by $G$ with the prescribed induced module action of $G$ on $M$.
Now the extension corresponding to the image of the corresponding element of $H^2(G,M)$ under the induced map $H^2(G,M) \to H^2(G,T)$ is
  Group< g, h, t | g^4=1, h^2=t^2=1, t^g=t, t^h=t, h^g=h*t >;

which defines a nonabelian group of order $16$, so it cannot be the split extension of $T$ by $G$.
There is a similar example with $G$ dihedral of order $8$.
