Megrim was an archaic term for a migraine; a fancy, a whim; a freak; or a caprice.
Megrims in the plural was a word used to refer to the blues; a state of depression.

A megrim is also a species of flatfish, a member of the sole family, caught off the Cornish coast but largely sent to Spain because we haven’t yet acquired the taste for it in this country..