According to numerous sources close to the situation, Foursquare is in the final stages of striking a funding deal with the very venture firm--Andreessen Horowitz--that had publicly dissed the hot social-location site and walked away from earlier talks.

The deal is likely to be completed and announced by early next week, at a valuation of about $80 million, barring unusual hiccups.

"Light at the end of a very long and very twisty tunnel," joked one source familiar with the situation.

Indeed, the wrapping-up of what has been a very convoluted funding process comes after a series of missteps and switchbacks over what's next for the start-up, which allows users to "check in" from various places.

The last curve came with serious talks for Foursquare to be acquired by Facebook, which came very close to happening-"one inch to the end zone," as one person close to the situation described it.

But those discussions broke off largely due to price, strategy, and control issues, sources said.

In addition, Foursquare had recently been in serious acquisition talks with Yahoo as well, along with endless rounds of chatter with a variety of prominent Silicon Valley VCs--including Khosla Ventures, Accel Partners, and Institutional Venture Partners--over the last several months.

The overhyped interest is because Foursquare and many others like it have seen strong growth and much innovation, although it is not clear yet if that will translate into solid businesses. Still, many location-based companies are girding up with investments in order to race ahead.

That has also been the case with Foursquare, except its funding process has been unusually complicated, in part because of indecision and in part because of some very noisy deal-making.

In fact, that's what initially scotched very advanced funding talks between Foursquare and Andreessen Horowitz.

But after discussions with Andreessen Horowitz and other firms were leaked to the media, the high-flying New York-based Foursquare was smacked back hard by the higher-profile Silicon Valley firm, which is helmed by Internet icon Marc Andreessen and his longtime partner, Ben Horowitz.

"We withdrew our funding offer to Foursquare and we are out," said Horowitz in an interview with BoomTown. "This is playing out too much in public, and clearly someone has an interesting agenda here, so this is not something we want to participate in."

In addition--after making an offer three weeks ago at valuations lower than have been reported, though he would not specify the exact number--Horowitz said he felt the company had conducted a "process that is very long and undefined."

A company run by VC-pampered young geek dudes centered on game-playing was playing silly, immature deal games? This comes as a complete shock to...well, no one!

Still, at the same time, Horowitz left the door open. "If the process was changed, we still like the company," he said then. "But since it has been long and undefined, it is prone to manipulation."

And indeed, it looks like Horowitz finally won that contest of hardball with Foursquare CEO and co-founder Dennis Crowley.

But it was a very close call, said many, who noted that Foursquare thought acquisition talks with Facebook were almost in the bag, something many sources said Crowley had wanted most of all.

And in fact, Facebook would have been a natural fit for Foursquare, on paper. The only fit, really: Facebook's users already get the status-update concept, as well as the game-play part of the service.

"[Facebook] has something Foursquare won't be able to boast of for a very long time: A sales team to match the location service up with big brands and a self-service ad platform that local businesses can plug into."

Nonetheless, sources close to the company said Foursquare is now saying it wants more independence and more cash over stock in any deal with the social-networking giant.

Dictating terms to the powerful Facebook seems unlikely to be effective. And sources familiar with Facebook's thinking said the company simply felt it could do its own location service better, as well as federate many others in the arena.

Could that change? Sure, because when it comes to Foursquare, it seems like a wacky turn could be just around the corner!

Still, sources said that while the term sheet Foursquare has from Andreessen Horowitz is not quite done, it is nearly complete, with some remaining back and forth about the exact valuation for the social-location start-up, the funding number, and other small issues.

A representative for the firm declined comment.

Foursquare's current investors--who recently gave it a bridge investment--will also participate in the new round.

Foursquare's original $1.35 million funding was raised from Union Square Ventures and O'Reilly AlphaTech Ventures, as well as some well-known angel investors.

And then, after all the papers are signed, hopefully, we'll all see what Foursquare can do with a new pile of money.