Phase II trial to study the effectiveness of imatinib mesylate in treating patients who have stage III or stage IV ovarian epithelial or primary peritoneal cancer that has not responded to previous treatment. Imatinib mesylate may stop the growth of tumor cells by blocking the enzymes necessary for cancer cell growth