Before I proceed with this, I feel obligated to point out that if you search the archives hard enough, you should find the 100+ page thread about this very same subject. After a while it dissolved into "ninjaz pwn pirtaes cuse ninja asassin move kiked az bu pirates of the caribien waz stupid" and other arguments just as ridiculous.
If you want a serious answer, then you will have to erase every movie and video game you've ever seen from your mind. Otherwise it won't be "who would win", it would turn into "who has cooler movies." Plus, we all know how movies LOVE to be historically accurate. And The Deadliest Warrior is not a legitimate source for information.
Pirates (I'll assume the classical movie pirate, since their have been pirates and bandits in one form or another pretty much since the dawn of man) were essentially bandits. They raided ships and killed people for their own personal gain. They usually attacked unarmed or lightly armed merchant ships with crews that were inexperienced in combat. They avoided open conflict with military ships, preferring to run away. The "pirate's code" is an invention of Hollywood.
Most pirates were ex-soldiers who traded in their morals for coin after their term of service was up. So they were an even match, 1v1, with a typical soldier of the day. But they were motivated only by their own greed and were subject to lots of infighting; its a good bet that more pirates were killed by internal scuffles than by outside military forces.
Besides the usual cutlasses and knives, pirates used flintlock weapons. These were were horribly inaccurate, one-shot weapons with about a 50% chance of not firing. While these were effective enough in their day and age, flintlock guns alone would not guarantee absolute victory against an enemy like ninjas. Their "hand to hand combat", as someone called it earlier, was pretty much the same thing they did they were were in a bar fight half-drunk. They would not stand a chance against someone with years of martial arts training, ninja or otherwise, in unarmed combat.
Ninjas were, as far as we can tell from the few reliable records, were stealth operatives who either worked in guilds or clans as mercenaries, hiring out to the highest bidder; or they served one particular leader or nation out of a sense of duty, honor, etc. The primary focus of ninjutsu training was...
You know what? Screw it, its 11:36 pm right now. I'll post this again, finished, sometime tomorrow.

