What references must be acknowledged in a paper?
This is a question of academic honesty and due diligence.

If you did not arrive at the result yourself, but got it from someone else (either on SE or a homeless man on the street) then it is your responsibility to not claim credit for the result. Of course, in the case of the homeless man you can get away with claiming credit, and in most cases for SE, too. However, it is simply not honest.

If you arrived at the result by yourself, then as a research you should provide due diligence and check if the result is already known. This usually consists of checking the standard sources (i.e. published papers, books) and the communities which you are a part of. "Folklore" in mathematics is vast, and MO, math.SE, and cstheory are all becoming part of it. If you are aware that others arrived at a result before you then you should mention it in your paper (either with a full citation, if applicable, or with an acknowledgement). 

However, just like you are not expected to search the back-log of every journal ever published, you don't have to scour the whole internet, either. If you want precedent of this: consider all the results that were published independently in the west and the soviet union during the Cold War. It would have been unreasonable of the scholars on both sides to be fully aware of the work of the others.