When a company is on the brink of failure, it will often file for Chapter 11 bankruptcy protection. This allows the company to undergo a reorganization of business affairs, its debts, and its assets. Many companies that go bankrupt are able to settle with their creditors and then close up shop permanently. Enron, Worldcom and Lehman Brothers are just some well-known examples of bankrupt companies that never came back. On the other hand, some companies have managed to re-emerge from bankruptcy in better shape than before they went bust. (See also: What you Need to Know About Bankruptcy.

Recently, the low price of oil has caused some shale oil producers in the United States to shut down. Apparel retailer WetSeal and RadioShack, the ubiquitous consumer electronics retailer, have also filed for bankruptcy. Are these companies done for? Not necessarily. It is quite possible that they could make a big comeback in the future. (For more, see: What happens to a company's stocks and bonds when it declares chapter 11 bankruptcy protection?)

Below is a list of some of the most spectacular comebacks so far from companies that either went bankrupt or came nail-bitingly close to doing so.

Apple 

It is hard to believe that the world's largest company by market capitalization was once in dire straits. While never actually filing for bankruptcy, Apple (AAPL) was on the verge of going bust in 1997. At the last minute, arch-rival Microsoft (MSFT) swooped in with a $150 million investment and saved the company. People have speculated that Microsoft only did so because it was worried that regulators would regard it as a monopoly without the competition from Apple in the marketplace. 

General Motors 

Following the financial crisis of 2008 and the Great Recession, General Motors (GM), once the largest automobile manufacturer in the world, filed for bankruptcy and was ultimately bailed out by the federal government. Since then, the company has paid back its entire rescue package, earning the government a tidy profit on the venture, and is in its best financial shape in more than a decade. 

Ally Bank

Ally bank, now Ally Financial (ALLY), was the auto-financing arm of General Motors, extending credit to purchasers of its cars. The bank was bailed out alongside its parent to the tune of $17 billion by the U.S. Treasury Department. The company has emerged as a profitable business with a market capitalization of $11 billion and just reported better than expected earnings, double analysts expectations.

Chrysler 

General Motors wasn't the only car maker to go bust in 2008. American car manufacturer Chrysler (FCAU) was actually the first to fall. Despite a $4 billion government bailout package, the company was forced to declare bankruptcy in 2009. It was later purchased by European car maker Fiat and has seen above average success and growth since. 

Marvel Entertainment

With blockbuster movies such as "Spiderman," "The Avengers," and "Guardians of the Galaxy," it is surprising to note that the company filed for bankruptcy in 1996. This was before the company got into the movie-making business, when it focused solely on comic books. Today, the company's properties are worth billions of dollars with millions of fans around the world.

Six Flags 

Theme park operator and amusement company Six Flags (SIX) has 18 regional theme and water parks throughout North America, home to some of the world's biggest and fastest roller coasters. In 2009, however, the company declared bankruptcy after racking up more than $2.5 billion in debt which it could not pay back.

Texaco

Now part of Chevron (CVX), Texaco was once one of the most dominant integrated oil companies in the world. A legal dispute with competitor Pennzoil in the 1980s however caused it to file bankruptcy: Pennzoil asserted that Texaco owed it $10.5 billion, which Texaco couldn't pay. 

Sbarro

Sbarro operates and franchises more than 1,100 fast-food style pizza and Italian-food restaurants worldwide. Sbarro went bankrupt twice: first  through a Chapter 11 bankruptcy reorganization in 2011 and then again in 2014. The company has re-emerged with the help of a collaboration of private equity firms to transform the company's image to a more fast-casual style, rather than its previous kiosk or food counter concept.

The Bottom Line

Bankruptcy is often the end of a company, but it doesn't have to be in every case. The companies in the list above have re-emerged from bankruptcy to become profitable and successful. As an investor, it is useful to note that bankruptcy isn't always the end of the line for a company, and that through buying shares of companies as they emerge from bankruptcy, reorganization can be a potential source of excess returns.

Want to learn how to invest?

Get a free 10 week email series that will teach you how to start investing.

Delivered twice a week, straight to your inbox.