Women who use birth control pills for several years not only increase their risk of suffering a heart attack while on the pill, but are up to three times as likely to have one years after they stop using it, according to a new study.

The longer a woman uses the pill, the greater her chance of a heart attack later, the study also indicates.

Medical epidemiologists --scientists who study disease patterns-- have long known that oral-contraceptive users have from three to four times the normal incidence of heart attack.

They have been less sure, however, whether the pill's chemical effects linger and affect the heart later on.

The question was tackled by doctors at Boston University's Drug Epidemiology Unit five years ago.

With Harvard and University of Pennsylvania scientists, they studied the records of 556 women aged 25 to 49 who had a myocardial infarction-- or heart attack -- and entered 155 Massachusetts, New York, Connecticut, Pennsylvania and New Jersey hospitals between 1976 and 1979.

The results, published in today's New England Journal of Medicine, should "be interpreted with caution" until repeated in other studies, the authors say.

Among all past pill users, including those who used it only a short while, there were just 20 percent more heart attacks than expected.

But women aged 40 to 49 who had used the pill for more than five years had 60 percent more attacks than other women the same age. And women 40 to 49 who had used it for 10 years or longer had 2 1/2 times as many attacks.

In short, the researchers say, the heart attack rate was apparently increased "approximately twofold to threefold" in women who used the pill for more than 10 years before quitting.

Between 5 and 8 million American women, and an estimated 25 to 50 million worldwide, now use the pill. Of the women the Boston epidemiologists surveyed, nearly one in 10 had relied on it for five years or longer.

However greatly a woman increases her chance of a heart attack, that chance may still be small, depending on age.

Few women under 40 have heart attacks. At 40 to 44 (according to extrapolations of federal Framingham, Mass., data), the normal rate is .3 attacks per year per 1,000 women; at 45 to 49, 1 per 1,000; at 50 to 54, 1.7; at 55 to 59, 1.9, but then at 60 to 64, 7 per 1,000.

So far the Boston University researchers can only comment on the effect on past users up to age 49, and on women who stopped using the pill for up to nine years. It will take further study to measure the effect on the same women later.

Women who both use the pill and smoke cigarettes add greatly to their chance of a heart attack. But the new data on past pill use showed an increased risk for non-smokers as well.

The reason may be that all past use of the pill helps clog arteries, and in this way helps cause heart attacks, according to Dr. Dennis Slone and his co-authors.