I haven't tried this out yet, so I don't know if I missed anything.
Near the bottom of the editor entry is a section for user tags. Go in there for your feat and define one, for example, ArmorOptim.
Now, in a script on your feat, running before Mithril reduces the armor category (First/10500), use the same foreach you're using above to find all the heavy armors, and then execute the following:
Code:
perform eachpick.assign[User.ArmorOptim]
You've now tagged all the heavy armors with something that won't be altered when mithril operates.
For the later search, look for that tag alongside everything else:
Code:
foreach pick in hero from BaseArmor where "mClass.Heavy | User.ArmorOptim"
Now, you'll find all the armors that are heavy armor at this point, or were heavy armor before mithril was applied.