Rihanna may be throwing it up, and watching it all fall out right now … but at one point the Barbados singer was on the verge of bankruptcy!

According to new legal documents obtained by TMZ, Rihanna claims that she had $11 million in her bank accounts at the beginning of 2009, but by the end of the year, she only had $2 million left.

And to make matters even worse … her expenses doubled, which left her on a financial cliff and “effectively bankrupt,” as TMZ put it.

TMZ says Rihanna puts the blame of her financial disaster totally on her “stupid” accountant, who she claims gave her the dough to purchase a house in the $7 and $7 and-a-half million dollar range. Rihanna ended up later selling the house for a $2 million loss.

RiRi also claims her accountant never gave her the heads up that her 2009 tour “Last Girl on Earth” was losing money.

So now Rihanna is reportedly suing her former accounting firm Berdon LLP, claiming they mismanaged her money and also alleging that they took 22% commission from her, which is well above the standard.

However, Berdon struck back with a countersuit, claiming that Rihanna’s accusations of poor accounting and money management aren’t true. In fact, Berdon says that the commission they took was actually signed off on by RiRi in an engagement letter giving them permission to do so.

Berdon says that RiRi’s “own financial action or inaction” or the actions of others working for her caused to lose all of those millions, and NOT them.

But despite going bankrupt just a few years ago, Rihanna is doing MUCH better now and has a net worth of $43 mil.

Guess that just goes to show that anyone can bounce back if they want it bad enough and actually put it in the work to make it happen