With the score tied 4-4 in the sixth, Dirks launched a one-out pitch from Brian Duensing over the right field wall, putting the Tigers ahead to stay.
Miguel Cabrera added run-scoring hits in the seventh and ninth innings to provide some insurance for Detroit, which evened its three-game series.
Doug Fister (7-7) surrendered four unearned runs on five hits over eight innings to collect the victory. He walked two and struck out seven.
Second-place Detroit stayed two games behind the American League Central-leading Chicago White Sox with the win.
Duensing (2-8) was roughed up for five runs on eight hits over six frames.
Josh Willingham belted a three-run homer for the Twins, his career-high 30th blast of the season.