Grant Imahara complained of migraines in the days before doctors discovered his brain aneurysm, and emergency surgery, sadly, couldn't save him ... TMZ has learned.
Sources close to the "MythBusters" host's family tell us ... he'd been experiencing painful headaches for a few days before Saturday night, when he was having dinner with his girlfriend at a home in L.A.
We're told at some point during the meal, Grant's pain worsened and he felt dizzy, along with experiencing severe neck and back pain and numbness in his legs. After he showed signs of being unresponsive, his GF called 911 ... we're told this was around 9 PM.
Our sources say when paramedics arrived, Grant's vitals were normal but he was still in serious pain, so he was rushed to a hospital. We're told doctors soon realized he had a brain aneurysm, and he underwent emergency surgery.
Grant survived the surgery -- no small feat when dealing with an aneurysm -- but we're told he never fully recovered. He had another operation Sunday, but again came out unresponsive and in critical condition.
On Monday, we're told he had an MRI to prep for a third surgery ... but doctors discovered the extent of the damage was too severe. Grant was wholly unresponsive, and the decision was made to take him off life support.
As we reported ... the accomplished electrical engineer, roboticist and beloved Discovery host's sudden death, at just 49 years old, was a severe shock to his friends and longtime coworkers.
Former "MythBusters" host Adam Savage said, "Grant was a truly brilliant engineer, artist and performer, but also just such a generous, easygoing, and gentle PERSON. Working with Grant was so much fun. I’ll miss my friend."