Thank you so much for pointing me to the right direction. I was able to successfully come up with a solution to reset the build counter using PowerShell. Here is the code. I hope this will help someone out there as well.

I believe that the question was how to reset the build counter, not set the build number. Although the build counter normally forms part of the build number, i.e. build_number = 1.0.%build_counter%, setting the build number through a TeamCity service message doesn't have the effect of overriding the build counter, only the build number for the current build.

The solution that Hayato has come up with seems like it should do the trick though.