"At the age of 40, Mary became the first woman who..." is correct.
"Of 40-year-old Mary became the first woman who..." is incorrect.
However, the problem is the word "of." It would be correct to say
"40-year-old Mary became the first woman who..."
"At the age of 40, Mary..." is a statement about time. It is similar to saying
"In 1983, Sally Ride became the first American woman in space."
In "40-year-old Mary became..." is a statement about a characteristic or property of Mary. "40-year-old" is functioning as an adjective. It is similar to saying
"86-pound Olga Korbut became the first woman to perform a backflip-to-catch on the uneven bars."