Dundee were already missing the bereaved James McPake and ill Simon Ferry before goalkeeper Kyle Letheren suffered a bad knee injury in the warm-up at Fir Park.
But former Alloa goalkeeper Scott Bain came in for an assured Scottish Premiership debut and his team-mates never looked like giving up the advantage they got just after two minutes, when former Motherwell striker David Clarkson volleyed into the top corner from 18 yards.
Further goals from Gary Harkins and Greg Stewart put Dundee three up before the hour mark, amid some poor marking from the home side, and Dundee held firm after Henrik Ojamaa turned home from close range in the 62nd minute.
Hartley said: "We were really down to the bare bones this week. We had two bereavements. McPakes's dad died during the week and was buried today, so he missed out. (Iain) Davidson's stepfather passed away during the week, Ferry was diagnosed with bronchitis and Letheren twisted his knee during the warm-up.
"But credit to the guys out there. They really dug in and were fantastic.
"I thought we started really sharply, that was important after the run of results we had been on. We looked bright early doors and got two really good goals and it could have been more.
"Even in the second half, I thought in the first 10 minutes we created good situations, we were just a wee bit wasteful.
"We always knew Motherwell would come back into it and we had to change the shape a little bit throughout the match."