Generalised instanton counting in two, three and four complex dimensions