FORTUNE -- When President Obama's offshore drilling moratorium halted work off the Gulf Coast in late May, the industry spewed that Washington just doesn't get it. For every rig worker, they argued, there were three to four more jobs supporting deepwater operations -- 21,000 in all, according to Louisiana's Oil and Gas Association. How could President Obama's administration legally close 33 permitted drill sites in the Gulf of Mexico when nearly all passed inspection by the Minerals Management Service after the Deepwater Horizon's April 20 explosion?
Amid the pleading by politicians and talking heads, the industry's challenge was eventually won by an unlikely champion -- a local vessel company called Hornbeck Offshore Services.
Hornbeck (HOS), a $400-million vessel company in Louisiana's St. Tammany Parish, filed a lawsuit against the administration on June 7, a month after the moratorium started. It looked like a classic David versus Goliath battle: a boat operator going up against the federal government.
But Hornbeck was in a bind and had little to lose by going on the offensive. One-third of its sales come from contracting its 200-plus-foot vessels to transport diesel fuel, piping, and drummed material for deepwater drilling operations in the Gulf. Without drilling, its vessels were sitting idle.
"We didn't think from a gut reaction at the time that [the moratorium] was even legal," CEO Todd Hornbeck tells Fortune.
Of its 38 ships in the Gulf, Hornbeck has only contracted 12 to help in the cleanup efforts. That left about 26 ships either idle, on the spot market, or in short contracts to haul supplies. One drilling customer said it would cancel its contract and Hornbeck expected more drilling operators at the 33 sites to follow suit. Analysts cut earnings estimates and downgraded the stock.
No other choice but battle
Under a moratorium in the Gulf, Hornbeck would have been forced to find work for its ships in international waters. Just the commute abroad could take anywhere from 30 days to three months, and so-called cabotage laws make it difficult for foreign companies to quickly find work in international markets.
"We decided, if they're going to shut us down, we've got to do something about it," Hornbeck recalls.
So the CEO and his lawyers dug through the government's report to find holes. A dozen other Gulf-based businesses with more than 10,000 employees joined Hornbeck in the suit, among them, Bollinger Shipyards of Lockport, La., which earns 50% of its sales from constructing and repairing vessels for Gulf production. Their argument centered on the legality of the ban when many drillers met all regulatory requirements.
The case culminated on Tuesday with an injunction against the ban issued by U.S. District Judge Martin Feldman in New Orleans. In his sharp opinion, Feldman agreed with Hornbeck's argument that the broad ban was arbitrary and capricious. "If some drilling equipment parts are flawed, is it rational to say all are?" he wrote. "Are all airplanes a danger because one was? All oil tankers like Exxon Valdez? All trains? All mines? That sort of thinking seems heavy-handed, and rather overbearing."
Hornbeck heard of the verdict while taping an interview for the CBS Evening News. The White House vowed to appeal, and Department of Interior Secretary Ken Salazar planned to testify to a Senate subcommittee Wednesday in support of a ban.
In a curious twist, it appeared the market expected good news. On Friday, call options to buy the stock at a higher price outnumbered puts by 19 to 1, and shares gained 4.5%. And earlier last week company founder Larry Hornbeck bought more than $300,000 worth of shares, capping a week of more than $600,000 worth of purchases by Hornbeck insiders at the lowest prices since March 2009, according to Thomson Reuters data.
After a brief spike following the ruling announcement, Hornbeck shares closed down slightly on Tuesday and shed another 2% by mid-day Wednesday.
For his part, Hornbeck says he's just happy to be back in business. "We're ready to go to work today -- and we can do that today." But drilling in the Gulf is likely to resume slowly, if at all, as companies like Royal Dutch Shell (RDS.A) and others wait to see how the appeals court rules before restarting work.