Brandon Segal scored twice in a 1:22 span in the second period to give the Stars a 3-2 lead, but Stastny and Chris Stewart answered with goals during a stretch of 2:41 later in the middle frame to put Colorado in front.
Stastny and Darcy Tucker both scored second-period power-play goals. Colorado is 8-for-20 with the man-advantage over the past six games. Colorado is 21-11-4 when it scores at least one power-play goal.
Stastny's second goal, which came from beyond the right circle at 12:23 of the third period, pushed the Avs' lead to 5-3.
Milan Hejduk added a goal for the Avalanche, 4-3-0 since the Olympic break, to help maintain the club's runner-up spot behind Vancouver in the Northwest Division.
Jamie Benn added a goal and Mark Fistric had two assists for the Stars, who are 1-5-1 since the break.
Hejduk's wrist shot from the right circle got through Dallas goaltender Marty Turco's pads to give Colorado a 1-0 lead at 10:19 of the opening period.
Benn drew the Stars even at 1-1 at 14:31 of the first period, shoveling a shot into an open net off a centering pass from James Neal.
Tucker put Colorado in front 2-1 at 4:28 of the second period on a one-timer from the slot with 34 seconds left on a tripping penalty to Dallas' Trevor Daley.
Segal's first goal 1:31 later tied it, and the forward then gave Dallas the lead at 7:21 on a one-timer from the top of the right circle.
Stastny's power-play deflection at 11:05 of the second period made it a 3-3 game, and Stewart's wraparound at 13:46 gave the Avalanche a 4-3 edge despite Dallas' 19-12 shot advantage in the period.
At that point, Stars coach Marc Crawford replaced Turco with Kari Lehtonen, who played his third game since being acquired in a trade with Atlanta on Feb. 9.
NOTES: The Stars were playing the second game of a six-game homestand. ... Stewart had four goals in four games against Dallas this season. ... Stars D Nicklas Grossman (back) missed his fourth straight game. ... Colorado C Stephane Yelle and LW Cody McLeod sustained leg injuries in the first period. ... The Avs are also without D Ruslan Salei (torso), RW Brandon Yip (shoulder) and RW David Jones (knee). ... Segal, claimed off waivers from the Los Angeles Kings on Feb. 11, has four goals and two assists in his past six games. ... The game wasn't televised in Dallas-Fort Worth, breaking a streak of 1,101 Stars games (including playoffs) that had been available on local TV. It was originally scheduled as an NBC "flex" game, but the network decided to show Washington-Chicago instead and no local station picked up the game.