Tarek El Moussa — real estate veteran and star of HGTV’s “Flip or Flop” — might be a master at home-buying now, but he wasn’t always so savvy. In fact, he made a massive mistake when purchasing his first home.

On Thursday, El Moussa, 36, told Realtor.com about the first time he bought a house. At the time, El Moussa was 21 and searching for a home in Orange County, California for $400,000.

He found a listing that he describes as the “perfect bachelor pad,” which even included a 300-gallon shark tank. The asking price of $800,000 was double his budget, but he fell in love with it, and still splurged on the home, thanks to a loan.

Big mistake.

After he was approved for the $800,000 loan and bought the home, El Moussa admits he was broke.

“And I was very, very broke. With no money for furniture, I ended up living in an empty house for nearly nine months,” El Moussa writes for Realtor.com. “That was fifteen years ago, and although I laugh looking back at it now, the experience taught me an important lesson: Buying a home is exciting. So exciting, in fact, that it's all too easy to get swept up in your emotions and make some mistakes.”

Since that disastrous mistake, El Moussa has become much savvier, and is quite the real estate guru. He received his real estate license at 21, and after the housing bubble burst, switched gears from selling mega-mansions to flipping properties.

Now, El Moussa’s advice for first-time home buyers is inspired by his mistake — he cautions against buying a place that's beyond your budget.

“Financial peace of mind is worth its weight in gold,” El Moussa writes for Realtor.com. “This is why banks cap our borrowing limit — they know the breaking point, even if you don't.”

Indeed, Adam Contos, co-CEO of real estate company RE/MAX, previously told CNBC Make It that first-time home buyers should avoid taking on more house than they can afford.

“The key is understanding the monthly costs of owning, and making sure, before you move forward, that your income covers it all with enough left over to fund the life you want," Contos says.

"Stretching a little is fine, but only if careful analysis, insight and consideration are also part of the decision."

Don't miss: Inside Rob Lowe's $47 million California mansion — where Oprah's a neighbor