Winger Hastie (20), who will leave to join the Ibrox side on a four-year deal this summer, had unsavoury chanting directed at him by travelling fans as he warmed up in the first half and he was also barracked when he came on as a 72nd minute substitute for Gboly Ariyibi.
Goals by Scott Tanser (penalty) and Murray Davidson earned seventh placed Saints the win which means that Motherwell's hopes of finishing seventh are over with only next Saturday's home game against Livingston remaining this season.
The first scoring opportunity after four minutes in Perth saw David Wotherspoon's free-kick from the left flank met by the head of Davidson, whose effort was straight at Mark Gillespie.
Within a minute, Motherwell's Carl McHugh miscued an effort wide from outside the box at the other end.
The open start continued on eight minutes when Davidson headed over for Saints after good build-up between Tanser and Matty Kennedy.
Motherwell went so close to breaking the deadlock on 20 minutes when Ariyibi's shot from close range was blocked on the line by Tanser. Ariyibi claimed for a penalty for handball and was booked for his protests to referee Colin Steven.
St Johnstone took the lead from the penalty spot on 33 minutes when Tanser shot home powerfully after Charles Dunne's challenge on Chris Kane was adjudged to be a foul.
Motherwell star man David Turnbull then produced a powerful 42nd minute shot from outside the box which stung the palms of Saints keeper Zander Clark.
Gillespie made a fine save in the final action of the first half when he leapt high to block a stinging Davidson shot following Wotherspoon's through pass.
But St Johnstone did go 2-0 up just two minutes into gthe second half when Michael O'Halloran's low cross from the right was finessed home by the right foot of Davidson with the visiting defence posted missing.
Turnbull was again proving to be Motherwell's biggest attacking threat and he swivelled before shooting wide from 20 yards with his right foot on 51 minutes.
Chris Cadden's right footed daisy cutter on 65 minutes didn't miss the left hand post by much as the Steelmen continued to battle away.
St Johnstone substitute Callum Hendry then headed over the bar at the other end following a free-kick from the left at the other end.
Gillespie had to dive low to his left on 74 minutes to turn a Davidson curler around the post.
Hastie had a chance to score within 10 minutes of coming on when he got the ball after Clark had flapped at Tait's cross from the left, but his weak effort didn't trouble the home goal.
A swift Saints breakaway in injury time culminated in substitute Danny Swanson having a shot blocked by the onrushing Gillespie.
Motherwell: Gillespie, Tait, McHugh, Aldred, Cadden, Campbell (Semple 81), Ariyibi (Hastie 72), Grimshaw, Dunne (Johnson 56), Turnbull, Scott.
Referee: Colin Steven