Principal bundles that can't be detected by spheres The question I'm trying to answer is the following:

Let $P \to X$ be a principal $G$-bundle (over a connected CW complex)
  satisfying that all pullbacks to spheres (of arbitrary dimension) are
  trivial. Is $P$ trivial? If not, what's the simplest example for a
  faliure of this?

The following "proof" must be wrong since a very authoritative figure told me today that this should not be true even at the level of the $2$-skeleton.
The " Proof " :


Let $f: X \to BG$ be the classfing map of $P$ (assume everything is
  pointed). Any map $g: T \to X$ satisfying that $f \circ g$ is null
  homotopic (i.e. $f \circ g \cong *$ where $*$ is the trivial map)
  factorizes through the homotopy fibre of $f$ which is $E_f=\{(x,\gamma) \in X \times BG^{I} | \gamma(0) = *,\gamma(1)=f(x) \}$. 
For a map $g: S^n \to X$, triviality of the pullback bundle $g^*P$ is
  equivalent to triviality of $g \circ f$ and by the above equivalent to
  $g$ factorizing through $E_f$. Since any map to $E_f$ gives a map to
  $X$ we deduce a bijection for all $n$ of homotopy classes $[S^n,X] =
 [S^n,E_f]$ concluding that $E_f$ and $X$ are weakly homotopy
  equivalent. (Starting here I assume that $E_f$ has the homotopy type
  of a CW complex, although I'm not sure if that's necessary). By
  whitehead we have that $X \cong E_f$ ("strongly" homotopy equivalent).
We proved that the homotopy kernel of $f:X \to BG$ is homotopic to
  $X$. Consider now the identity map $id_X\in[X,X]\cong[E_f,X]$. We have
  that $f=f \circ id_X \cong *$ (null homotopic) by the property of the
  homotopy kernel. QED.


So now my question has two parts:
1) What's wrong with the above proof?
2) What's the simplest example of a principal bundle (or vector bundle) that can't be detected by spheres?
 A: The simplest example of a principal bundle that can't be detected by spheres:
The $S^1$-bundle over the 2-dimensional torus $T^2$ whose total space is the quotient $Heis_3(\mathbb R)/Heis_3(\mathbb Z)$ of the 3-dimensional real Heisenberg group by its integral subgroup (matrices with coefficients in $\mathbb Z$).
This can also be described as the $S^1$-bundle over $T^2$ whose first Chern class is the generator of $H^2(T^2;\mathbb Z)$.
A: If all maps are involved are pointed, your question is equivalent to the following: if $f : X \to BG$ is a map (where $X$ is connected) such that the induced map on $\pi_{\bullet}$ is zero, is $f$ zero (nullhomotopic)? The answer is no, although it's easiest to give a counterexample if we replace $BG$ with an arbitrary space $Y$ (although if $G$ is allowed to be any topological group, $BG$ can be any connected space). 
For example, if $X = BG$ for a discrete group $G$ and $Y = B^2 A$ for an abelian group $A$, then $X$ and $Y$ do not share nonzero homotopy groups in any degree, but maps $BG \to B^2 A$ correspond to classes in group cohomology $H^2(G, A)$, or equivalently to central extensions $A \to E \to G$. (This is a basic but important class of counterexamples to many naive guesses about how homotopy theory and higher category theory work; for example, it shows that a functor between 2-categories is not determined by what it does to objects, morphisms, and 2-morphisms. In this case all of the interesting data of a map $BG \to B^2 A$ is in coherence isomorphisms.) 
As for what goes wrong in your proof, the condition says that if $g : S^n \to X$ is any map, there exists some trivialization of the pullback bundle $g^{\ast} P$. This means that the natural map $\pi_0 [S^n, E_f] \to \pi_0 [S^n, X]$ is a surjection, not a bijection. To get a bijection on $\pi_0$ you also want trivializations to be unique up to homotopy. 
Let's see explicitly how your proof breaks down in the above example. Let $n = 1$ in the example $X = BG, Y = B^2 A$ above. Here the homotopy fiber of a map $f : BG \to B^2 A$ is $BE$ where $E$ is the central extension classified by $f$. A map $g : S^1 \to BG$ picks out an element $g \in G$ (conveniently). The composite $f \circ g : S^1 \to B^2 A$ is always nullhomotopic, so each $g$ always lifts to a map $\widetilde{g} : S^1 \to BE$, or equivalently an element $\widetilde{g} \in E$, which is clear since $E \to G$ is surjective, so admits a section. But lifts are not unique, and there's no reason we can choose lifts so that $g \mapsto \widetilde{g}$ is a homomorphism (which would correspond to a section of $BE \to BG$). 
