Moshe sent them, a thousand from each tribe and Pinchas the Elazar the Kohen with the holy vessels and the trumpets in his hand. -Numbers 31:6
A few verses beforehand in Number 31:2, G-d tells Moses to avenge the people Israel (נקם נקמת בני ישראל). How did Moses disobey G-d in this situation? The verb לנקום, which would more accurately be translated as "redress the past wrongs [in the form of fighting] (see Deuteronomy 32:35, Isaiah 1:24)" is an active verb. Moses should not have sent Pinchas to avenge the people Israel. Moses should have done it himself. Why did Moses stay behind, thereby disobeying G-d's directive?
The Midrash Rabba (Bamidbar, Matot 22:4) says "The verse states 'Moses sent them,' G-d told Moses 'go avenge,' meaning you personally, and he sent others? Rather because he was raised [as a young adult] in the Land of Midyan, Moses said, 'it is not proper that I should cause suffering to those who were kind to me.'"
We see something very similar happen in the Exodus narrative. During the beginning of the Ten Plagues, Moses was not the one who turned the river into blood, but it was his brother Aaron. Why was this the case? Because when Moses was an infant, the river had carried him to safety, and Moses thus abstained from the first couple of plagues as a way to show הכרת הטוב (gratitude). If Moses showed gratitude for an inanimate object, all the more so for individuals who showed hospitality to Moses.
While Moses did not intervene in the ultimate result of G-d's directive [because the Midianites' sins were egregious enough for their comeuppance], Moses reinterpreted G-d's commandment in order to show gratitude towards the Midianites. The fact that G-d did not chide or punish Moses for disobeying a direct order is astounding. We see that obeying G-d is not an absolute. We also realize the importance of individuals exercising their own judgment about what is the will of G-d, what G-d wants from us, and when there are two conflicting Jewish values, which supersedes which. Much like Abraham did with sacrificing a ram in lieu of his own son, Moses made the correct decision in expressing gratitude instead of obeying a divine directive. In this case, Moses was living up to the namesake of יהודי (Jew): being grateful in every situation, even when that means disobeying G-d. Moses is an archetype of gratitude, and I can only hope that all Jews strive to live up to our namesake that makes us Jews.