I think we've seen that a lot of Bashir's experiences during the DS9 years, especially the stuff with 31 and Garak, were about a naive and cocky guy becoming seasoned. Was Extreme Measures squeaky clean morality? Definitely not. But it was certainly a more defensible act than what we've seen 31 do. Bashir is a duly authorized civil servant, he reported what he was doing to his CO, he undertook the dirty deed to save his friend and prevent a genocide, and he gave Sloan the opportunity to simply give him what he wanted.