Your second equation is not the full contribution resulting from the Wick decomposition of the numerator up to order $\lambda$ but only the (physically relevant) tree contribution of order $\lambda$. If you fully work out $$\langle 0 |{\rm T} \left\{\phi(x_1) \phi(x_2) \phi(x_3) \phi(x_4) \left(\mathbf{1} -(i\lambda/4!) \int\! d^4x \, \phi(x)^4 \right) \right\}|0\rangle,$$ you will find four different classes of contributions:
(i) A linear combination of products of two disconnected two-point functions like $$\langle |{\rm T }\phi(x_1) \phi(x_2) |0 \rangle \langle0 | {\rm T} \phi(x_3) \phi(x_4) |0\rangle $$ (in all possible combinations).
(ii) The connected tree diagram $$\sim -i \lambda \int\! d^4x \, \langle 0|{\rm T}\phi(x_1) \phi(x)|0\rangle \langle 0 |{\rm T}\phi(x_2) \phi(x)|0\rangle \langle 0 |{\rm T} \phi(x_3) \phi(x) |0\rangle \langle0|{\rm T} \phi(x_4) \phi(x) |0\rangle$$corresponding to the expression shown in your question (prior to Fourier integration).
(iii) A linear combination of the product of a tree propagator with a two-point function with a one-loop insertion like $$\sim \langle 0|{\rm T} \phi(x_1) \phi(x_2) |0\rangle\, \lambda \!\int \! d^4x \, \langle 0|{\rm T}\phi(x_3) \phi(x)|0\rangle \langle0 |{\rm T}\phi(x_4) \phi(x) |0\rangle \langle0|{\rm T}\phi(x) \phi(x) |0\rangle, $$ again in all possible combinations. (Again, a disconnected diagram.)
(iv) Graphs consisting of two diconnected tree propagators (like in (i)) and a two-loop vacuum bubble like $$\sim \langle 0|{\rm T}\phi(x_1) \phi(x_2) |0\rangle \langle 0|{\rm T} \phi(x_3) \phi(x_4) |0\rangle \, \lambda \!\int \! d^4x \langle 0| {\rm T}\phi(x) \phi(x) |0\rangle^2.$$
On the other hand, computation of the denominator up to the same order in $\lambda$ yields $$\langle 0 | {\rm T} \left\{ \mathbb{1} -(i \lambda/4!) \int \! d^4x \, \phi(x)^4 \right\}|0\rangle =1- \frac{i \lambda}{8}\int d^4x \langle 0 | {\rm T} \phi(x)\phi(x) |0\rangle^2.$$ Note that the contribution from the disconnected vacuum bubble exhibits an infrared divergence. Because of translation invariance, $\langle 0 |{\rm T} \phi(x) \phi(x) |0\rangle=\langle 0 |{\rm T}\phi(0) \phi(0)|0\rangle$ is a constant and the integration $$\int \! d^4x \, \langle 0 |{\rm T} \phi(0) \phi(0) | 0\rangle^2$$ requires an infrared regularization of space-time, $\int \! d^4x \to V T$. You can easily convince yourself that the contributions from the disconnected vacuum bubbles cancel in the ratio of your first equation to order $\lambda$ (remember to use the first two terms of the geometric series for the expansion of the denominator). In fact, contributions with disconnected vacuum bubbles cancel to all orders in $\lambda$ rendering the ratio infrared finite. (This does, of course, not remove the ultraviolet divergences present in $\langle 0 |{\rm T} \phi(0) \phi(0)|0\rangle$ or in the loop integrals.) This explains also, why diagrams with disconnected vacuum bubbles are never considered in actual calculation. On top of that, disconneted diagrams like (i) or (iii) do not contribute to $S$-matrix elements and (ii) remains the only tree contribution to the scattering cross section.
Of course, you can find this in all good text-books on quantum field theory. Nevertheless, you are strongly encouraged to work out the calculation sketched above in all details (keeping track of signs and factors) to familiarize yourself with the whole "machinery".