Dumbledore was dead anyway, the ring that was destroying his hand was cursed and all Dumbledore/Snape could do was slow that curse down - it's stated in the book that it will kill him before long. Dumbledore was also disarmed and weakened from drinking the weird lake water/potion, and Snape can't protect Dumbledore and fight off half a dozen death eaters on his own
Killing your most powerful wizard to get a man on the inside may not make sense... but it may make sense to mercifully kill an ally who, if left to Bellatrix, would likely be tortured first.
Dumbledore was dead anyway, and probably in a much more horrible way - so to kill him in that circumstance to gain a man on the inside is probably worthwhile.
Add in the facts that
Snape made a binding (and in this case, binding means "Will kill you if you break it") magical promise to Malfoy's mother to kill Dumbledore if Malfoy couldn't
Dumbledore wanted to save Malfoy from having his soul destroyed by killing Dumbledore. Dumbledore was dead anyway and he knew it, but he always believed everyone was redeemable, and didn't want Malfoy to kill him. In this, we see he was proven right - at the end the Malfoys run away, and Draco is seen to be at least civil with Harry years later.
And it's obvious that it's not as simple as "Why kill your best guy?"