The shrewd and tenacious goblins are the Horde's newest playable race with the Cataclysm expansion. Though considered the go-to neutral race in World of Warcraft thus far, the goblins have an active history of working with the Horde -- as well as some shady deaings with many of Azeroth's other sentient races -- in previous Warcraft games. So strong is the goblins' reputation for driving a hard bargain that a dwarvish saying for doing the impossible is "cheating a goblin".
Interestingly, they weren't always the eccentric and self-destructive inventors, tradesmen, and arms dealers we know them to be today. The first reference to goblins in official lore, chronologically, is in the War of the Ancients trilogy of novels, which indicates that the goblins have been around for quite some time. Once a reclusive, barely sentient race native to the isle of Kezan, the race was in thrall to the jungle trolls, employed as miners in the island's tunnels and caves. It was while mining that goblins first discovered the mineral kaja'mite, the key to their meteoric rise in intelligence.
Sensing some sort of power to the mineral, the goblins hoarded it and shaped it into ritual objects. Soon enough, the goblins noticed a drastic rise in their intelligence and began to create technology, starting first with weapons and armor and expanding to far more complex items. Using their newfound intelligence, the goblins freed themselves of the jungle trolls and took over the entire isle. During this golden age, goblins developed Azeroth's first steam technologies -- supposedly far more advanced than even current dwarven technology -- and other incredibly complex devices. Unfortunately, they discovered too late that kaja'mite had a finite supply, and their continued increase in intelligence was entirely dependent on the mineral. Fleets of ships soon departed from their capital city of Undermine, sailing out to all corners of Azeroth in a desperate search for more kaja'mite.
It was a futile effort. No more kaja'mite existed in the world, and after a few thousand years, the goblins found that their intelligence had planed out. They could no longer operate or create the technologies they had once made and worked with ease. Some remnants of their old genius remained, though it mainly resulted in the hilariously jury-rigged goblin tech we see today. The planet's other sentient races no longer desired the dilapidated and dangerous machinery and goblin commerce suffered significantly.
Seeing that they could no longer rely on their machinery for income, goblins embraced commerce and began their storied history as the world's finest and shrewdest tradesmen.
Though not involved with the First War, the goblins saw the potential for enormous profit by joining the Horde during the Second War. In return for supplying the Horde with weapons of war, the goblins would receive gold and loot from the war. The goblins had every reason to believe that the unstoppable orc juggernaut would win the war, but those illusions were soon shattered. Though initial profits were fantastic, the goblins considered the losses -- both plausible and definite -- too great, and until now have considered the Horde partnership a disaster. The goblin Trade Princes, directing trade and commerce from the goblin capital city of Undermine, forbade any further exclusive alliances with the world's sentient races.
In the Third War, goblins returned to their roots of playing both sides, and supplied the Horde and Alliance with transportation and machinery. Many goblins offered their services as mercenaries for both factions as well, and the war ended mostly successfully for the goblins. In World of Warcraft, the goblins run the majority of neutral cities around terrestrial Azeroth, as well as a few in Outland. Up until now, in fact, the goblins were quite comfortable in their neutral lifestyle.
With the return of Deathwing and the Cataclysm that he's brought onto Azeroth, the goblins find themselves in true mortal danger for the first time in thousands of years. The stirring of the earth resulted in an active volcano erupting from under Kezan, and a Trade Prince seized the opportunity to make some fast gold. Promising his fellow goblins safe passage off of the island, he took their life savings and sent them on their way -- to slavery.
His plan (and his ship) fell apart when it ran afoul of some Alliance ships that were assaulting a lone Horde ship. The end result of the crossfire was a shipwreck on the Lost Isles off the coast of Kalimdor, where the Goblins would rekindle their alliance with the Horde -- this time for protection, not profit.