Yes. Coffee would be a good choice to relieve migraine as it contains caffeine. You may find that most pain relievers also have caffeine as one of its ingredients, as it increases their effectiveness by 40%. Hence, whether you prefer drinking ibuprofen or aspirin, these medicines will work better and faster, and will keep the pain away longer when combined with caffeine.
However, there is also what we call rebound headache that results from the overuse of medication or overdependence to caffeine. When we are regularly exposed to caffeine, dependency develops, and the brain tends to expect that it will soon be given dose of caffeine. Hence, when this condition is not met, withdrawal symptoms occur, which includes headache itself.