The earlier introduced method of calculation of quark distributions in hadrons, based on QCD sum rules, is improved. The imaginary part of the virtual photon forward scattering amplitude on some hadronic current is considered in the case, when initial and final virtualities of the current $p^2_1$ , and $p^2_2$ are different, $p^2_1\ne p^2_2$ . The operator product expansion (OPE) in $p^2_1$ , $p^2_2$ is performed. The sum rule for quark distribution is obtained using double dispersion representation of the amplitude on one side in terms of calculated in QCD OPE and on the other side in terms of physical states contributions. Double Borel transformation in $p^2_1$ , $p^2_2$ is applied to the sum rule, killing background non-diagonal transition terms which deteriorated the accuracy in previous calculations. The case of the valence quark distribution in the pion is considered, which was impossible to treat by the previous method. OPE up to dimension 6 operators is performed and leading order perturbative corrections are accounted. Valence u-quark distribution in $\pi^+$ was found at intermediate x, $0.15 < x < 0.7$ , and normalization point $Q^2=2{\mathrm{\,GeV}}^2$ . These results may be used as input for evolution equations.