You're taking cohomology of classifying spaces, aren't you? I thought first that the answer was positive, but there was a mistake in my argument. I can recycle the argument to show that you obtain a counterexample whenever the following two conditions hold:

$$\hom(\pi_1G,A)^{\pi_0G}\neq 0,\qquad H^2(BG,A)=0.$$

I don't have any example satisfying these conditions off the top of my head, but I share this in case someone comes up with one (maybe $O(2)$ with some local coefficients $A$?) or shows it's impossible.

The short exact sequence

$$G_c\hookrightarrow G\twoheadrightarrow G/G_c=\pi_0G$$

induces a fibration after taking classifying spaces

$$BG_c\hookrightarrow BG\twoheadrightarrow B\pi_0G.$$

This, in turn, gives rise to a Serre spectral sequence

$$E_2^{p,q}=H^p(B\pi_0G,H^q(BG_c,A))\Longrightarrow H^{p+q}(BG,A).$$

The spectral sequence differential $d_r$ has bidegree $(r,1-r)$ and the cohomology groups $H^q(BG_c,A)$ are regarded here as $\pi_0G$-modules.

The morphism whose infectivity you want to prove decomposes as

$$E_2^{3,0}=H^3(B\pi_0G,A)\twoheadrightarrow E_\infty^{3,0}\hookrightarrow H^3(BG,A).$$

We have three exact sequences

$$E_2^{1,1}\stackrel{d_2}{\longrightarrow}E_2^{3,0}\twoheadrightarrow E_3^{3,0}$$

$$E_3^{0,2}\hookrightarrow E_2^{0,2}\stackrel{d_2}{\longrightarrow}E_2^{2,1}$$

$$E_\infty^{0,2}=E_4^{0,2}\hookrightarrow E_3^{0,2}\stackrel{d_3}{\longrightarrow}E_3^{3,0}\twoheadrightarrow E_4^{3,0}=E_\infty^{3,0}$$

The group
$$E_2^{n,1}=H^n(B\pi_0G,H^1(BG_c,A))$$
vanishes because $G_c$ is connected hence $BG_c$ is simply connected so $H^1(BG_c,A)=0$. Therefore

$$E_3^{3,0}=E_2^{3,0},$$

$$E_3^{0,2}=E_2^{0,2}=H^2(BG_c,A)^{\pi_0G}=\hom(\pi_1G,A)^{\pi_0G}.$$

If $H^2(BG,A)=0$ then $E_\infty^{0,2}=0$ and $d_3\colon E_3^{0,2}\rightarrow E_3^{3,0}$ must be injective. This spectral sequence differential is precisely the inclusion of the kernel of the map whose infectivity you wanted.