We first construct a derived equivalence between a small crepant resolution of an affine toric Calabi-Yau 3-fold and a certain quiver with a superpotential. Under this derived equivalence we establish a wallcrossing formula for the generating function of the counting invariants of perverse coherent sheaves. As an application we provide some equations on Donaldson-Thomas, Pandharipande-Thomas and Szendroi's invariants. 3 Kontsevich-Soibelman's (partly conjectural) formula ([KS]) also covers the setting in this paper. 4 After this paper submitted • Euler characteristic version of the DT-PT conjecture was proved by Toda, Thomas-Stoppa, Bridgeland ([Tod10, ST, Bri]) using Joyce's arguments, and • Joyce-Song provided an extension of the wall-crossing formula in [Joy08] to weighted Euler characteristics and an application for non-commutative Donaldson-Thomas invariants ([JS]).