I'm fairly sure it's the former, but it sounds even more stilted than the usual cases in which "I" is less common, but more correct.
It's "if it were me", as opposed to "if I were it". Compare: "If I were him" sounds good, but "If I were he" does not. The first pronoun is in the nominative case, the last one in the accusative. Also, see this.
As you stated in the question, “if it were me” is more common. I would use this form.
However, which is correct seems to be a common topic of debate. See Wikipedia for an analogous question about whether “it is I” or “it is me” is correct. Using “me” is more common, but some grammarians consider using “I” is the correct form. I am pretty sure that those grammarians consider that “if it were I” is the correct form.
Okay, I'm actually writing a prescriptivist answer. Even if you are a prescriptivist, logic compels the choice of "If it were me".
The supposed rule is that the object of a copulative verb, like be, takes the nominative case.
Justifications for the rule
Analogy with other languages
In some other languages, a similar rule is observed. For example, in Spanish, ser tends to agree with whichever argument is a personal pronoun, which is nominative:
Soy yo. am I "It's me." A veces el infierno somos nosotros mismos. At times the.MASC hell are.1PL we selves
But we're talking about English here.
In fact, if you're analogizing with other languages, there's precedent in French:
C' est moi. it is me "It's me."
The copula means equality; swapping the arguments
One common claim is that as a copula represents equality and equality is commutative, it should be possible to swap the arguments while preserving grammatical structure. That is, "I was the captain." and *"The captain was I." are supposedly essentially equivalent, and so the pronoun must be "I" in both cases.
This argument is bogus because most of the time, the copula is not a statement of equality. While you occasionally see sentences like "Rodentia is the rodent family" that are asserting the equality of two arguments, the copula is mainly used to establish subset relationships—
Cats are carnivorous mammals commonly kept as pets.
—or to attach a description (adjective) to a noun, asserting that the noun has a specific quality—
Cats are fluffy.
In the "subset" usage, reversing the arguments gives a semantically false result: "Carnivorous mammals commonly kept as pets are cats." (counterexample: my friend's dog is not a cat). And it doesn't even make sense for an adjective to be the subject: *"Fluffy are cats".
Similarly, the arguments may not even agree in number. Reversing "The Obamas are a family" to *"A family are the Obamas" is absurd.
Since the arguments of a copula are not semantically or grammatically interchangeable in general, there is no reason to insist on symmetry when its arguments happen to be personal pronouns.
Go by parsimony. The supposed rule is an exception to the general principle that the object of any verb—including copulas—takes an objective-case pronoun.
In English, a pronoun used as the "secondary" argument to an action verb takes objective case:
The snail slimed me.
*The snail slimed I.
Stative verbs, which semantic category includes copulas, are the same:
The snail likes me.
*The snail likes I.
Even stative (common) verbs with semantic meanings that overlap with the copula are the same:
The set of snails includes/contains me. The set of English-speaking snails consists of me alone. "Snail" means me.
*The set of snails includes/contains I. *The set of English-speaking snails consists of I alone. *"Snail" means I.
Why should copulas be any different?—
The snail is me.
*The snail is I.
An exception should be rejected absent a compelling reason to use it (e.g. if it were necessary to explain how the grammar actually works). But in normal English usage, this purported exception is simply not observed. This rule does not exist in English.
(The difference with Spanish is that word order is freer in Spanish than in English, so the argument about flipping the order is more plausible. And, of course, actual usage.)
And the real reason "me" is correct
is actual usage. The simplest resolution to the puzzle is to recognize that the rule you were taught is wrong, because it evidently doesn't match native speakers' mental grammar.
As others have said, no doubt the technically correct expression is "if it were I" because the verb is copulative. Some might argue that "me" is more common, and "I" is rather pedantic. However, if we go that direction one might also question the use of the subjunctive at all which is also verging on archaic.
If you are going with wrong, but popular, I'd recommend "If it was me..."
The verb to be does not take an object, so subject and complement are the same [nominative] case. This means that subject and complement can be reversed without doing great violence to the meaning. "I was the captain" or the slightly stilted "The captain was I" say the same thing. So in this case "If it were I" transposes to "If I were it" and this is all right. Try transposing "If it were me" into "If me were it" and one sees straight away that the correct form has to be "If it were I"
"If it were me" is the common usage, though grammatically it is wrong.
Many other examples of this kind of confusion, in which "everyone" uses a particular phrase wrongly, could be found. For example, when answering the phone, to say, "This is he" rather than "This is him," when someone has asked for me in particular, took me a while to get used to, because it is so uncommonly heard.
Using a phrase correctly, against the common usage, is a matter of training your ear. Transposing, as described in these posts, is one way to train yourself until the correct grammatical sense begins to sound right.
It seems that we have a "usage monitor" in which a phrase is repeatedly silently and often unconsciously inside our head to compare it to what we believe to be correct. If we can train that internal monitor to hear a phrase as if correctly said by a scholar, a hero, or a pretty girl with a soft voice, for example, we can overcome our predilection to insist on a wrong usage.
As for the implicit question of how it could be grammatically wrong when so overwhelming a percentage of people use a phrase incorrectly, is it not that some concepts (I could be doing it better...) are simply learned very early, before the rules are well-learned? And because the usage then becomes so common, it sounds right?
I have found this to be true in learning other languages, where a different set of common misusages are common, due to differences in grammatical structure and cultural mindsets.