Try to call this, after changing the mainImageId to null, which should tell EF to do an update before trying to delete:
dbContext.Entry(imageSeries).Property(x => x.MainImageId).IsModified = true;
Also, use RemoveRange instead of the foreach:
dbContext.Images.RemoveRange(images);