Does buying a Team Fortress 2 item on the community market through the Mann Co. store upgrade your account to premium?

No.

While the Mann Co. Store links to the Community Market, the Community Market is a separate entity.

You must buy an item from Valve itself using the Mann Co. Store, obtain an Upgrade To Premium Gift item, or buy The Orange Box in order to upgrade your account to premium.

Side note: The Valve Complete Pack no longer contains TF2 and will not count for this because of it.

Now that the Giftapult item is gone, the cheapest items on the Mann Co. Store is likely the same items you unlock via achievements, such as the Kritzkrieg. Keep in mind that you can "rent" an item first, which will reduce the amount you need to pay to buy it.