Maybe, only the one particle that Heisenberg gives to Tuco is actually Mercury(II) Fulminate. The others are just similarly textured random particles. When Heisenberg demonstrates Tuco the damage he can do, he is just bluffing to create explosion with other particles. The other particles were never Mercury(II) Fulminate. Thus, Walt must have taken care that the only Mercury(II) Fulminate doesn't react or explode by friction with other particles.
Also, Heisenberg is very careful about quantities. To add to that, he doesn't have much money at that part of series. So he must have created just one particle of Mercury(II) Fulminate to intimidate Tuco, that's it. Also, in later episodes, S05, Jesse explains to Hank and Gomez that Walter has far more luck on his side than them. So it was just pure luck that Tuco got Heisenberg's point in one particle use. Had Tuco retaliated against that explosion, Heisenberg would have not survived.