Maybe iDennis Crowleyt’s true: Nice guys do finish last in Silicon Valley.

When the venture capitalists at Andreessen Horowitz publicly scolded founder Dennis Crowley (right) and the others behind the fast-growing location-based check-in service Foursquare in the midst of funding negotiations in April, it seemed like Crowley had worn out the patience of the venture firm. Now, it looks like venture capitalist Ben Horowitz was playing hardball with Foursquare — and may have bluffed the company into a deal.

According to a report by AllThingsD, Andreessen Horowitz is in the process of finalizing a funding round with the Foursquare, most likely to be completed early next week. Two sources familiar with the deal described it as essentially done to VentureBeat. After we asked partner Marc Andreessen for comment, his new colleague, Margit Wennmachers, said that Foursquare is “obviously an exciting startup” but that the firm had no other comment.

The road to closing the funding was serpentine, as Foursquare was talking to seemingly everybody about funding and acquisitions. The most hype focused around a sale to Facebook, which apparently came very close to acquiring the New York City-based location startup, whose service allows users to announce their current location to a defined set of friends.

Foursquare was also in talks with Yahoo (reportedly pricing the company at around $100 million), and a bunch of Silicon Valley venture capitalists like Accel Partners, Redpoint VenturesInstitutional Venture Partners and Khosla Ventures. But Foursquare made the misstep of talking about their plans too much publicly, which was – at least ostensibly – the reason for Andreessen Horowitz temporarily walking away. Not everyone was duped, though.

Khosla partner Gideon Yu was reportedly keen on winning the deal. On June 13, he wrote a cryptic tweet:

“I’ll never play hardball with an entrepreneur to get a deal done, especially in public. Life is FAR too short for that…”

It’s not clear if Yu’s tweet was in reference to the bidding on Foursquare. But the dealmaking was fraught. Yu was formerly the CFO of Facebook, where Andreessen is still on the board of directors. So Yu was, in essence, bidding against his former bosses to win Foursquare.

Foursquare is seen as one of the hottest companies in the location space, although nobody is really sure what kind of business is to be made in with location-based services. The space is cluttered with many companies, most of them based around the idea of the check-in like Gowalla, Brightkite and Booyah, and everybody is expecting the social network giant Facebook to step in the arena soon – which is why a Facebook acquisition of Foursquare made for such hot speculation.

The best part of this deal? By keeping Foursquare independent, and bolstering its financial resources, Andreessen Horowitz has all but guaranteed we’re going to keep checking in on where this hot startup stands — as opposed to watching it disappear into Facebook’s fraternally welcoming arms.

Don’t miss MobileBeat 2010, VentureBeat’s conference on the future of mobile. The theme: “The year of the superphone and who will profit.” Now expanded to two days, MobileBeat 2010 will take place on July 12-13 at The Palace Hotel in San Francisco. Register now. Tickets are going quickly. For complete conference details, or to apply for the MobileBeat Startup Competition, click here.