In my opinion a lot of the answers are too negative about wikipedia, at least when applied to the part of wikipedia that applies to mathematics (my academic field, and the field the OP asked about).
I am a little surprised to hear people describe wikipedia as "unreliable", including links to university websites which say rather snootily to avoid it. This is how I felt about the mathematics on wikipedia circa 2006. It has gotten so much better in the intervening years, for the obvious reason: a lot of very mathematically experienced people (including at least one Fields Medalist, and also including me, for a period from about 2006 to 2008) put in a lot of time writing and vetting the articles. Where it stands now is that wikipedia is the best single repository of mathematical information in the world. It has been several years since I have seen anything that was wrong on a wikipedia math article. Some of these articles contain content that is difficult to find in other places, and some of the content is new: it is far from unheard of that someone just put in their own proof of a theorem. Many feel in principle that this sort of thing should not be done (I think I do; it's been a while since I've really thought about it), but in practice when someone writes a nice self-contained proof of a mathematical result, why delete it? So there is some really great stuff there: I think that most research mathematicians who are frequent users of the internet have by now learned mathematics from wikipedia.
As others have correctly pointed out, the question of "when to cite" is more complicated. Let me consider several of the alternatives:
1) Should you refer to wikipedia for standard proofs?
I think I believe that sometimes you should but I have never actually done it in a "serious research paper", in part because of exactly the sort of internet-phobic practices that Paul Garrett refers to in his answer. Recently I was writing a broad-audience article, and I wanted to say that a certain aspect of a classical construction -- the Galois connection between ideals of a polynomial ring over an algebraically closed field k and subsets of affine n-space over k -- worked verbatim with k replaced by an arbitrary integral domain. I ended up referring to Lang's Algebra for this. That is really not (ahem) ideal: this is one of the most "standard texts" in the sense that a large percentage of professional mathematicians have a copy in their office. On the other hand it is not free and even more mathematicians and math students don't have it. But billions of people have internet access, and surely wikipedia (for instance) does a perfectly good job of explaining the point. I wussed out and didn't give an explicit electronic reference, and I rarely do in formal writing. (In fact I have myself written many, many pages of mathematical writing -- as has Paul Garrett, by the way -- and I usually wuss out and do not refer to it in my formal writing either, even though I know exactly where I would like to point and a student would understand my research paper much more easily with that reference included.) At this point, when I say that something is "well known" I assume that students will look for it on the internet, and as a code between me and myself, at least, I try never to say that in papers except in cases where a student who looked for it on the internet would quickly and easily find it (and when that happens I don't worry so much about tracking down a print reference).
In the above case, the big advantage of wikipedia is its ease and convenience: it has almost exactly what any text would have but is much quicker, easier and freer to access.
2) Should you refer to wikipedia for non-standard proofs?
In other words, if a wikipedia article has a proof which is different from the one that you would find in any expensive math text, should you refer to that? If you want the reader to read that proof, I think you have to do refer to it or try to track down the source of the proof that made it into the wikipedia article. However, the latter brings me to my biggest complaint about the math articles on wikipedia: they're great for mathematical content. They can be really bad as references: e.g. they can be taken out of some standard source without referring back to that source. Or an article on the X-Y Theorem will have a statement of the theorem, motivation for the statement, the proof of the theorem, and then talk about further work and generalizations. That would make for a great lecture about the X-Y Theorem, but for an encyclopedia article there's a lot missing: who are X and Y? (Sometimes they don't even try to tell you, even when there are wikipedia articles on X and Y.) Where was the X-Y Theorem first published? (I'm sorry to tell you that many mathematically rock-solid articles don't contain this kind of primary source material.) Is the proof included in the article the original proof of X-Y? If not, where does it come from?
When I was involved with it, the culture of mathematical wikipedians was not good at addressing the above issues: if I asked for this information about an article, someone would usually nicely tell me that I was more than welcome to add it myself. I would mention that unfortunately I didn't know the source material that led to most of what other people included in the article...and there the matter usually got dropped.
So it may very well be the case that wikipedia has a proof of something for which it is not trivial to discern where the proof comes from. As an example, wikipedia has a really nice proof of the Schwartz-Zippel Lemma. It is not the original proof, I think -- it's slicker. Where does it come from? I couldn't tell from the article itself. This is not a hypothetical example: I wrote a brief expository note including this proof. As you can see, I did refer to the wikipedia article. However, I should say that this is an article in the informal sense of the term: I wrote it up for myself, spoke in a colleague's seminar about it, and kept the document for myself. I have not tried to publish it anywhere, nor would I, since it is "just an exposition" of a proof of Zeev Dvir's resolution of the Finite Field Kakeya Problem. This brings me to my last point:
3) When should you include proofs from wikipedia in your articles?
If you use a wikipedia proof in your article in a critical way, then you should include a reference to it (or where it comes from, if possible). However, if you are using a wikipedia proof in a critical way in your article, is your article a research article or even a "serious expository" article? Why would a journal want to republish something that is available in a standard source?
In the OP's example he mentions including a proof of the Pythagorean Theorem. No math journal I know is going to allow you to include (any one of; I'm sure it gives several) wikipedia's proof of the Pythagorean Theorem, but not because it comes from wikipedia: they're just not going to want you to rehash such old-hat stuff. To be honest, the introductory passage "For example, suppose you're writing an article about triangles..." raises some eyebrows in this regard: are you trying to formally publish an article about triangles? Good luck with that: it's going to be tough. Such articles are published, but for every one that is, probably a hundred are rejected.
I also think that in a formal article -- even, perhaps even especially, if it's an expository article -- the burden falls more highly on you to investigate primary source material. If you're teaching a class or something, then it's helpful to say exactly where you got the material from. But if you're writing an article, it becomes more important to track down the provenance of the intellectual content itself: that is a much more challenging thing to do. Still though I think there are cases where the answer really will be that the argument appeared for the first time on wikipedia, in which case you should cite it there.
4) What about the "unreliability" of wikipedia articles?
This is really "weak sauce" for math articles, because unlike most encyclopedia articles, mathematics articles are self verifying by any sufficiently qualified reader. So saying "Don't include this proof from wikipedia because wikipedia is full of errors" sounds silly to me: on the one hand lots of published books have a higher density of errors than wikipedia math articles; on the other hand, every proof you read you're supposed to check anyway. So don't worry about whether it's correct: see whether it's correct. Most proofs in wikipedia articles are no more than a page or so in length, so they can be checked in a relatively short time. If it's not correct, fix it or tell someone about it!