The Red Wings had forged a 2-2 tie 5 minutes into the final frame when Danny Cleary netted his fifth of the year.
But with Colorado's Ryan Wilson off on a cross-checking penalty, the Avalanche got a 2-on-1 break when they caught the Wings on a line change. Gabriel Landeskog fed Galiardi a pass and he tapped it home 9:22 into the final frame.
Ryan O'Reilly scored in the second period and added an empty-netter for Colorado, which downed Detroit for the first time in three meetings this season.
Semyon Varlamov stopped 27-of-29 shots to earn the victory.