As a rule, one must first shun evil and then seek to do good. It makes no sense to put on fine clothes before one has cleansed oneself of mud. There is no point in trying to elevate oneself spiritually while one is engaged in behavior that is morally base.
However, one may argue that a positive deed is the best method to extricate oneself from negative behavior, and that a tiny bit of light can banish a great deal of darkness. The verse in psalms says "Avoid evil; do good." and can be read "Avoid evil BY doing good." Indeed the Rabbi of Kotzk said that the reason one should not sin is not because it is forbidden, but rather because one should be so occupied in doind what one should be doing that one simply has no time to sin. At any rate, even the former interpretation does not mean that one must be completely free of sin before doind mitzvos, but that one shoul dat least be in the process of divesting oneself of objectionable acts, working toward a goal of total observance.
From p. 107 Lights Along the Way R. Twerski 1995 Artscroll