I've definitely attacked a city, fought a battle with some heroes and troops (maybe 4-5 total), not captured the city, attacked again and fought the barely-revived heroes together with the non-previously-involved troops and city garrison. It could be that there were more than 9 units in the city, I didn't check. It was still confusing, though.