This is from Tzidkat Ha-Tzadik para. 64:
The list of examples, espcially Moshe vs. Korach and the reading of the Tanur shel Achnai narrative, is incredible.
Sometimes a person sees clearly that God is helping him and acquiescing to his actions. Nevertheless, this is no proof that his actions are truly upright. Regarding this it says 'He guides you upon the path you take...' tupon which Chaza"l expounded (BT Makkot 10b) "The path upon which a person wants to go, there he is led."
This can be seen regarding Eliyahu, about whose withholding of the rains was, according to our Sages (Sanh. 113a) overly harsh in God's eyes, God nevertheless assisted Eliyahu in miraculously eluding Ahab...
Regarding this it says 'It is not in Heaven' (BT BM 59b). Even though God assisted R' Eliezer by performing several miracles to show that the law accords with him, the contemporary sages felt that this was only because that was the path that R' Eliezer had chosen.
This is also the complaint of the Israelites against Moshe [after the Korach episode], "You have caused the death of God's people!" even though they had witnessed their exceedingly miraculous demise. Nevertheless, they thought that this was not a proof that Moshe and Aharon were correct, rather that they had chosen that path and had sufficient merit to cause the death of Korach's group...
The logic of this insight - that just becuase God's got you back doesn't mean that you're doing the right thing - has a number of implications. God can be seen here as the good parent - who bails his kid out of jail or pays for college even though it's not his first choice. It's saying to the kid - don't confuse acquiescence with approval. That this would even extend to a case where the remification is loss of human life, like in the Korach example, is astounding.
It also seems to be saying that in order for God to get your back, you must really be sincere in what you're doing, and really believe it to be the right thing. If you are, then God may still cover for you. Lookng at the events of 38 years ago (the Six-Day war), and Israel's crushing - and miraculous - victory, the implication here is that the miracle is no proof of the rectitude of the State of Israel, only of its sincerity and it's 'zechuyot'. It was no 'ma'aseh satan'. But it's still no proof of its truth.
Perhaps that's the idea behind the miracle of the oil on Chanukah as well (R' Tzadok actually does suggest this, but I can't remember where): the victory doesn't prove anything. The gratuitous miracle that takes place afterward is God's seal of approval - not just acqiescence (R' Tzadok calls it a 'Gushpanka') on the endeavor of the Hasmonean revolt.
Regarding the story of the Sadducee, it makes sense that the corollary to R' Tzadok's proposition would hold true as well - one's failure isn't a proof that he's wrong or insincere (like Korach's boys, who died in an eerily similar way), especially if he's going up against someone equally sincere (like the Pharisees).