The NHL rules are contradictory in this circumstance, and do not specify what course of action is to be taken. I know this is a little contrived, but is not a long-shot to occur.
Relevant rules, emphasis mine:
24.1 Penalty Shot –
A penalty shot is designed to restore a scoring opportunity which was lost as a result of a foul being committed by the offending team, based on the parameters set out in these rules.24.6
Should two penalty shots be awarded to the same team at the same stoppage of play (two separate fouls), only one goal can be scored or awarded at a single stoppage of play. Should the first penalty shot result in a goal, the second shot would not be taken but the appropriate penalty would be assessed and served for the infraction committed.24.7 Timing -
If the foul upon which the penalty shot is based occurs during actual playing time, the penalty shot shall be awarded and taken immediately in the usual manner notwithstanding any delay occasioned by a slow whistle by the Referee to allow play to continue until the attacking side has lost possession of the puck to the defending side, which delay results in the expiry of the regular playing time in any period.78.5 (xi)
During the delayed calling of a penalty, the offending team cannot score unless the non-offending team shoots the puck into their own net. This shall mean that a deflection off an offending player or any physical action by an offending player that may cause the puck to enter the non-offending team’s goal, shall not be considered a legal goal. Play shall be stopped before the puck enters the net (whenever possible) and the signaled penalty assessed to the offending team.78.6
Only one goal can be awarded at any stoppage of play.Source: http://www.nhl.com/nhl/en/v3/ext/rules/2015-2016-Interactive-rulebook.pdf
Rule 24.1 details what a penalty shot is: it replaces a lost scoring opportunity.
Rule 24.7 tells us that the penalty shot officially occurs at the stoppage of play, not when the infraction occurred. This means that when the attacking side is able to maintain control of the puck after the infraction, and they pull their goalie, and manage to score on themselves (explicitly allowed as a goal for the offending team in rule 78.5 (xi)), the penalty shot would occur at the exact same stoppage of play as the offending team's goal.
However, this is a problem. We know that only one goal can be awarded at any stoppage of play, as detailed in both Rules 78.6 and 24.6.
So what happens? Does
(a) the offending team's goal count, and the penalty shot is not taken,
(b) the offending team's goal not count, and the penalty shot is awarded,
(c) the offending team's goal count based on the outcome of the penalty shot (i.e., if the penalty shot is good, the goal is disallowed, but if the penalty shot fails, the goal is allowed),
(d) the offending team's goal count, and instead of the penalty shot, a penalty is assessed and served by the offending team,
or (e), both goals are awarded, despite the rules saying only one can be awarded at any stoppage of play.
Scenarios (a) and (e) seem very unlikely. Scenario (b) seems pretty likely, though there is nothing in the rules that should disallow the offending team's goal. Scenario (c) seems to be the outcome most supported by the rules, as the scoring opportunity the penalty shot restores occurred before the offending team's goal. Lastly, Scenario (d) seems supported by a very liberal interpretation of Rule 24.6.
Any help or more rules that could provide clarification or shed some more light is greatly appreciated. I've thought about this for a few years and I desperately want scenario (c) to be true, though I suspect it's (b) or (d).