What is the source for the idea that doing some good thing 3 times constitutes a vow? I looked through Hilkhot Sevuot and Nedarim, and in the Entziklopedia Talmudit under Hazaka, and I could find no such idea.
If a person decides to intentionally do something which is a "chumrah" (voluntary strict practice, not required by law) and also intends that his practice be his new way of acting forever, (AND he is well aware that it is not obligatory,) then it has the halachic force of a neder (vow) even if he only does it one time. (see Shulchan Aruch Yoreh Deah 214:1; based on Talmud tractate Nedarim 15a.) The novelty here is that the vow takes effect without a verbal declaration. (D'Rabbanan)
If a person had in mind that the good practice would be a one time affair (or for the next 4 times for example, but no further) then that is OK. (This means that a person can limit the vow by such parameters.) If he had in mind that the practice would specifically not be binding, then it is not a vow at all. If a person accidentally thought that what he was doing is obligatory, then we pasken like the authorities there (214:1) that there is no vow.
The Gemara and Shulchan Aruch in the source does not mention 3 times.
Rav Shlomo Ganzfried (1804 - 1886) writes in Kitzur Shulchan Aruch 67:7, that in addition, if the person did not intend to have his new practice be from now on and forever, but had nothing particular in mind, then we apply the rule that if he did it 3 times (without having in mind that it is not a vow,) then it becomes a vow.
Other Rabbis and prayerbook authorities (commenting on hataras nedarim in the machzor) apply this rule like the Kitzur SA does. It is based on the principle of a "Chazakah" being created by anything done 3 times. (See Talmud Baba Basra - beginning of 3d chapter, for the general halachic concept of 3 times being a chazakah.)
Finally, it should be noted that there are therefore halachic leniencies regarding such a vow, such as special instances when the vow might not be in force, and how to retract such a vow in front of a Rav. As always, one should consult their LOR.
I'm not sure about an original source, but it's mentioned in Hatarat Nedarim done on Erev Rosh Hashanah:
או אֵיזו הַנְהָגָה טובָה או אֵיזֶה דָבָר טוב שֶׁנָּהַגְתִּי שָׁלשׁ פְּעָמִים וְלא הִתְנֵיתִי שֶׁיְּהֵא בְּלִי נֶדֶר (text source)
... Or any good act or good thing that i have done three times and did not stipulate that it should not be a neder ... (my own translation)