Increasingly desperate, the forces holding Vienna were on their last legs when, in August, Imperial forces under Charles V, Duke of Lorraine, defeated Thököly at Bisamberg, 5 kilometers northwest of Vienna.