Percy Harvin was sleeping in a hospital bed last month following a scary collapse at practice when twice his heart stopped beating for several seconds.

"They'd just barge in the room and be like, 'Harvin, you OK?'" said the young Minnesota Vikings star. "And I'd be like, 'Um, I think so.' And they were like, 'Your heart wasn't beating.' So I was like, 'Um, what do you want me to do?'"

Harvin told the story on Monday with a light-hearted smile and a look of satisfaction on his face, describing the latest and most dramatic developments in his lifelong struggle with migraine headaches — a struggle that he says might finally be finished.

Harvin has been diagnosed with sleep apnea, a disorder that causes temporary breathing stoppages during sleep. Told of his frequent trouble getting a good night's sleep, Harvin's doctors decided to test for the condition. They determined it as a trigger of the debilitating migraine symptoms that have dogged him for years.

Harvin now uses a breathing machine while he sleeps, with a mask placed over his nose, and he said he hasn't had a migraine since his hospitalization on Aug. 19.

"It's a 100 percent difference," Harvin said. "I'm not waking up groggy. I'm waking up feeling refreshed and ready to go. So like I said, hopefully that's it."

Harvin left the Vikings two days into training camp following his grandmother's death and a migraine attack soon followed, keeping him out of practice for the better part of the month. Three days after he rejoined his teammates, Harvin had another episode and collapsed on the field.

"It's been a blessing," he said. "Had I never been in the hospital from the start, they'd have never figured out that it's sleep apnea. I probably would still be going through the same thing now. Like I said, everything happens for a reason. A lot of doctors think that's what it was, from the lack of sleep. They seem real confident, so of course that makes me confident."

Harvin said he's no longer taking medication for the migraines, either. The adverse reaction to that, he clarified Monday, was the cause of his collapse, not from the migraine itself.

"I'm just finally glad we got all that simplified," he said. "Just get sleep and eat right and hopefully get this turned around."

Harvin had only one catch for 12 yards in Minnesota's season-opening loss at New Orleans. With Pro Bowl wide receiver Sidney Rice out for several more weeks following hip surgery, the Vikings are counting on the reigning NFL Offensive Rookie of the Year even more.

Harvin and the Vikings host Miami on Sunday.