United’s spirited second-half fightback had looked set to give them the points at Tannadice, as two goals in three minutes from Nadir Ciftci and Andy Roberston put them ahead.
Those strikes cancelled out a 30th-minute opener from Motherwell's Henri Anier, but the visitors ensured a share of the spoils when Ainsworth fired home with 14 minutes left.
United offered little in the opening exchanges, and Motherwell took a deserved lead when a strong counter-attacking run down the left by Zaine Francis-Angol found Anier unmarked in the box, and he swivelled to dispatch a neat left-footed finish for his fourth goal of the season.
But the hosts were a completely different side after the break and equalised after 54 minutes when Ciftci found space on the left and ran unchallenged into the area, where he drilled a left-footed finish through the Lee Hollis' legs.
Three minutes later the game was turned on its head when Robertson was allowed to run 40 yards down the channel before sending a left-footed shot past the despairing dive of Hollis.
Motherwell nearly forced an equaliser in the 66th minute when skipper Keith Lasley bent a 30-yard free-kick against the upright, but it was the introduction of Ainsworth that made the difference.
Having been brought on just past the hour mark, he ran into space and delivered a rasping shot from 35 yards that bent into the top corner to level things up.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.