For a semi-simple simply connected algebraic group G we introduce certain parabolic analogues of the Nekrasov partition function (introduced by Nekrasov and studied recently by Nekrasov-Okounkov and Nakajima-Yoshioka for G=SL(n)). These functions count (roughly speaking) principal G-bundles on the projective plane with a trivialization at infinity and with a parabolic structure at the horizontal line. When the above parabolic subgroup is a Borel subgroup we show that the corresponding partition function is basically equal to the Whittaker matrix coefficient in the universal Verma module over certain affine Lie algebra - namely, the one whose root system is dual to that of the affinization of Lie(G). We explain how one can think about this result as the affine analogue of the results of Givental and Kim about Gromov-Witten invariants (more precisely, equivariant J-functions) of flag manifolds. Thus the main result of the paper may considered as the computation of the equivariant J-function of the affine flag manifold associated with G (in particular, we reprove the corresponding results for the usual flag manifolds) via the corresponding "Langlands dual" affine Lie algebra. As the main tool we use the algebro-geometric version of the Uhlenbeck space introduced by Finkelberg, Gaitsgory and the author. The connection of these results with the Seiberg-Witten prepotential will be treated in a subsequent publication.