The connotation of flatter as a verb depends to a considerable extent on the particular situation in which it appears. Nevertheless different phrases containing the word flatter do tend to have very have different weightings of positive or negative connotations.
The expression "I'm flattered," for example, tends to occur in situations where the speaker means to express genuine appreciation for something that someone has just said or done. But in sharp contrast, the expression "you flatter yourself" tends to come up in situations where the speaker intends to criticize someone for overestimating his or her insight, importance, cleverness, or other characteristic or quality. So "I'm flattered" is usually a positive statement, and "you flatter yourself" is often an very negative one.
"You flatter me" falls between those two expressions on the positive-negative continuum. On the one hand—as the poster notes—it can function in a positive way to express modesty in response to a compliment. On the other hand, it can contain a note of suspicion, expressing an idea closer to "You're trying to flatter me, but I can see through your little gambit."
I wouldn't worry that saying "you flatter me" to a friend or polite acquaintance is likely to be misinterpreted. People who grow up with expressions like this one are generally aware of their flexibility and context-specificity, and they tend to be quite good at reading the surrounding circumstances to arrive at an accurate understanding of the speaker's intention in using the phrase.