I'm six years out of surgery, and in the past few years have found a noticeable moderation and reduction of my ocular migraines. They occur less frequently, and when they do occur, it is for less time. Some of it is just gaining awareness of what the triggers are (for me: strenuous exercise, caffeine, and lack of sleep. Anything messing with blood pressure.). The addition of Propranolol to my daily pill intake was a big help as well (it's a beta-blocker commonly prescribed for ocular migraines). And frankly, they stop disrupting you over time, to the point you almost ignore them.
On the theory side, I've recently been reading articles about concussions in sports - specifically, in football and certain winter Olympic sports (like bobsledding). A common thread in these articles is that one of the first, and lingering, symptoms of a concussion is flashing lights, auras, sensory sensitivity, and headaches. This continues for months/years after the concussion. Just yesterday, there was a story about an NFL player held out of the game because of migraines following a previous concussion.
Just a hypothesis here: But being on the bypass machine, temporary lack of blood flow, aortic clamping, and additional traumas put upon your body during the heart surgery process, could result in a soft concussion, or a similar brain injury. I've written about it before, but I woke up from my surgery with massive flashing lights, which continued almost every hour for days after my surgery. When you throw in the fact that those with valve issues, aneurisms, and similar circulatory problems are prime candidates for migraines, the surgery could be a huge trigger.
But because no doctor or surgeon seems to have any interest in researching the connection between heart surgery and migraine severity, we are all left to speculating on our own. There was a period of my life after surgery when the migraines forced a change to my lifestyle, and became one of the most frustrating and disruptive results of my surgery - which is why I've focused on it in these forums. The good news is it does lessen and subside, to the point you almost forget entirely about it. Good luck.