Hi!
Here's a set of examples to think about -- examples which, in combination, might help to illustrate the nuances of these different tenses:
(Note that in all of these sentences, "burned" is in the simple past tense; it's the other verb ("step") that I'm varying.)
His foot burned because he
had stepped on a jellyfish. -->
Past Perfect
He stepped on a jellyfish at some intant in the past, prior to the moment at which his foot burned. Probably, he just stepped on a jellyfish by accident earlier that afternoon or something.
His foot burned because he
had been stepping on a jellyfish. -->
Past Perfect Progressive (also called
Past Perfect Continuous)
We've got a continuous tense that emphasizes duration, so we can conclude that this guy is a masochist (perhaps also a sadist) and was repeatedly stepping on a jellyfish (stomp, stomp, stomp) for a WHILE earlier that afternoon.
His foot burned because he
was stepping on a jellyfish. -->
Past Progressive (also called
Past Continuous).
Here, too, the guy was stepping on the jellyfish repeatedly, but since we're not using a perfect tense, we're
not situating this stepping before the moment his foot burned. So this guy was still in the process of stepping on the jellyfish when we commented that his foot burned. His foot burned *as he was doing it.*
His foot burned when he
stepped on a jellyfish. -->
(Simple) Past
Now we're back to a scenario in which the stepping is one instantaneous event, probably an accident, but here, "stepped" is in simple past just like "burned" is, so the single moment of the step and the single moment of the burn are exactly contemporaneous. Step = ouch. (That's also why I've changed the "because" to a "when" -- i.e., to emphasize the simultaneity.)
--
Your specific example is interesting because you give a limited time frame over which the action took place -- "for three years." In this case, as between the two example sentences, I would only ever say the first:
We had been talking about repainting the front room for three years and last night we finally bought the paint.
"For three years" emphasizes duration, so it is indeed good to get a progressive (= continuous) tense in there, but if I'm able to say it's three years, that time period must have *ended* by the time we bought the paint, so to show that it's ended, you want to use a perfect tense. So perfect progressive is the perfect combination. If you use simply the past progressive ("were talking"), it makes it seem as though the talking was still in progress and unfinished -- and as though the three years were still in progress and unfinished -- at the moment you bought the paint. But that's not logical, since you wouldn't be able to say "for three years" unless those years had ended.
Hope that's helpful!