A new method is suggested to calculate the $B\to \pi\pi$ hadronic matrix elements from QCD light-cone sum rules. To leading order in $\alpha_s$ and $1/m_b$, the sum rule reproduces a factorizable matrix element, in accordance with the prediction of the QCD factorization approach. Whereas the QCD factorization can only take into account the nonfactorizable corrections induced by hard-gluon exchanges, the method suggested here also allows a systematic inclusion of soft-gluon effects. In this paper, I concentrate on the latter aspect and present a calculation of the nonfactorizable soft-gluon exchange contributions to $B\to \pi\pi$. The result, including twist 3 and 4 terms, is suppressed by one power of $1/m_b$ with respect to the factorizable amplitude. Despite its numerical smallness, the soft effect is at the same level as the $O(\alpha_s)$ correction to the QCD factorization formula for $B\to \pi\pi$. The method suggested here can be applied to matrix elements of different topologies and operators and to various other B-decay channels. I also comment on the earlier applications of QCD sum rules to nonleptonic decays of heavy mesons.