We consider a natural generalization of the Carlsson-Okounkov Ext operator on the K-theory of the moduli spaces of stable sheaves on a smooth projective surface. We compute the commutation relations between the Ext operator and the action of the deformed W-algebra on the K-theory groups. The conclusion is that the Ext operator becomes a vertex operator. When S = A^2, this statement gives a mathematical interpretation of the AGT correspondence for U(r) gauge theory.