Let $Q$ be a group and $A$ a $Q$-module. Call two extensions $G, G'$ of $Q$ by $A$ weakly equivalent, if there is a commutative diagramm
$$ 0 \to A \to G \to Q \to 1 $$
$$ \hspace{2pt} \downarrow \hspace{20pt} \downarrow \hspace{20pt} \downarrow $$
$$ 0 \to A \to G' \to Q \to 1 $$
with vertical isomorphisms. Denote the corresponding set of equivalence classes by $W(Q,A)$. Since $G,G'$ are isomorphic, if the extensions are weakly equivalent, $W(Q,A)$ is finer than isomorphism classes, but coarser than $H^2(Q;A)$.
In order to describe the relation between $W(Q,A)$ and $H^2(Q;A)$, some notation is needed: Call $(\varphi, \alpha) \in Aut(Q) \times Aut(A)$ compatible, if $\alpha(\varphi(q)\cdot a) = q \cdot \alpha(a)$ for all $q \in Q, a \in A$. Such a pair induces an automorphism $(\varphi,\alpha)^*$ of $H^2(Q;A)$ (see Brown: Cohomology of Groups, III, after Cor. 8.2).
Taking into account that cohomology is contravariant in the first argument, let $T\subseteq Aut(Q) \times Aut(A)$ be the subgroup of all pairs $(\varphi, \alpha)$ such that $(\varphi^{-1}, \alpha)$ is compatible. Then, $T$ operates on $H^2(Q;A)$ through $(\varphi,\alpha) \cdot x = (\varphi^{-1},\alpha)^*(x)$. Now, the central result is:
There is a bijection between $W(Q,A)$ and the orbits of $H^2(Q;A)$ under
the action of $T$.
The proof consists in essential of the fact, that for a 2-cocycle $f: Q\times Q \to A$
and a compatible pair $(\varphi, \alpha)$, the extensions
corresponding to $f$ and $f':= \alpha \circ f \circ (\varphi^{-1} \times \varphi^{-1})$
are weakly equivalent.
As noted above, weak equivalence is finer than isomorphism. But in some situations, $W(Q,A)$ will directly classify isomorphism classes.
a) If the center of $Q$ is trivial, then $|W(Q,A)|=I(Q,A)$ (as defined in the question).
b) Suppose $A$ is finite and let the integer $k$ be coprime to $|A|$. Thus, multiplication by $k$ is an automorphism of $A$ that is compatible with $\operatorname{id}_Q$. Hence, for $x \in H^2(Q;A)$, its orbit contains $kx$ for all $k$ comprime to $|A|$. In particular:
If $|H^2(Q;A)|$ is a prime, then $|W(Q,A)| = 2$ and $I(Q,A) \le 2$.
Hence, in your example ahead, there are at most two isomorphism classes of groups of
order $p^2$ and since $C_p \times C_p$, $C_{p^2}$ aren't isomorphic, we are done.
Edit: Including a proof of a)
Let $\mathcal{C}$ be the class of groups $G$, satisfying $Z(G) \cong A$ and $G/Z(G) \cong Q$. By fixing such isomorphisms each $G \in \mathcal{C}$ exhibits a central extension
$$\mathcal{E}_G: \quad\quad A \cong Z(G) \hookrightarrow G \twoheadrightarrow G/Z(G) \cong Q.$$
The first key observation is: An isomorphism $\phi: G \to H$ maps $Z(G)$ isomorphically onto $Z(H)$ and therefore induces a commutative diagramm with vertical isomorphisms:
$$\mathcal{E}_G: \quad\quad A \cong Z(G) \hookrightarrow G \twoheadrightarrow G/Z(G) \cong Q$$
$$\hspace{17pt} \phi \downarrow \hspace{17pt} \phi \downarrow \hspace{17pt} \bar{\phi} \downarrow $$
$$\mathcal{E}_H: \quad\quad A \cong Z(H) \hookrightarrow H \twoheadrightarrow H/Z(H) \cong Q$$
Hence $\mathcal{E}_G$ and $\mathcal{E}_H$ are weakly equivalent and we obtain a map
$$\mathcal{C}/\cong \to \mathcal{W}(Q,A),\quad [G] \mapsto [\mathcal{E}_G].$$
Since a weak equivalence between $\mathcal{E}_G$ and $\mathcal{E}_H$ implies $G \cong H$, this map is injective. Surjectivity follows from the second key observation: Let
$$\mathcal{E}: \quad\quad A \hookrightarrow G \overset{\kappa}{\twoheadrightarrow} Q$$
be a central extension, i.e. $A \le Z(G)$. Since $\kappa$ is epi, $\kappa(Z(G)) \le Z(Q) = 1$, implying $Z(G) = A$. Thus $G \in \mathcal{C}$ and $[\mathcal{E}_G] = [\mathcal{E}]$.