Dye is a substance that adds color to something else. Die means to stop living. "Dye" sounds like "die". Sometimes when people see markers of aging, they "want to die" which means they're just really upset and freaking out. This joke is referring to hair, so dye can be understood literally. The actress is thinking of dying her hair. Or, it can be understood as the actress was extremely upset and "thought she'd die". 
When an actress saw her first strands of gray hair she thought she ' d dye .