This is an old question, in my mind. I have always believed the answer is the third period, but others disagree.
This is not a full answer, but an answer that may lead to the full answer.
To avoid confusion, I interpret "winning goal" as "the most recent goal that put the team ahead with no further lead changes." For example, if the winning team shuts out their opponent and scored the first goal during the first period, the "winning goal" was scored during the first period.
Using the following query on Pro Hockey Reference:
For all games, from 1979-80 to 2018-19, in the regular season, team won game, for games that ended in regulation, for goals that put the team ahead, sorted by descending Game Date.
One can determine "the most recent goal that put the team ahead with no further lead changes," though it would take removing all go-ahead goals for each game in the query except the most recent goal that put the team ahead during the respective game.