Hearts became the first non-Old Firm side to qualify for the Champions League thanks to Paul Hartley's second-half penalty against Aberdeen.
Paul Hartley (right) scored the vital winner for Hearts
Hartley blasted home after Russell Anderson had handled in the area to make sure the Edinburgh side will finish second ahead of Rangers.
The Dons rarely threatened and had Scott Severin red-carded late on.
And the result means Gretna qualify for the Uefa Cup whether or not they defeat Hearts in the Scottish Cup final.
It had been the first time that Hearts had kept the same line-up for two games in a row since the New Year period.
And an Aberdeen side with Richie Byrne in for Gary Dempsey were immediately under pressure as they sought to extend their own seven-game unbeaten run and qualify for the Uefa Cup.
Deividas Cesnauskis quickly turned a Roman Bednar cut-back past the left-hand post from 16 yards out.
Hearts dominated possession, but it was a scrappy game and the frustration of the home fans increased as the first half wore on.
Aberdeen lost striker Steve Lovell to injury, Darren Mackie coming on as his replacement after 32 minutes.
Hearts captain Steven Pressley celebrated at the end
And Hearts nearly grabbed the lead four minutes later, only for Rudi Skacel to guide his left-foot volley back across the goal and past the post.
Skacel and Bednar both had good efforts from long range, but Aberdeen gave Hearts a fright shortly after the break.
A Richie Byrne cross found Barry Nicholson 12 yards out, but goalkeeper Craig Gordon saved the midfielder's header.
And Hearts continued to pile on the pressure, eventually taking a deserved lead after 51 minutes.
Skacel's corner from the right appeared to be flicked on past flailing goalkeeper Jamie Langfield by Bednar, leaving Anderson little option but to punch the ball clear.
Referee Stuart Dougal decided to only show a yellow card as he thought the ball was not heading for the net, but Hartley made Aberdeen pay the penalty from the spot.
Substitute Saulius Mikoliunas had a point-blank header brilliantly saved by Langfield as Hearts' tension visibly eased.
Former Hearts midfielder Severin was sent off for a bad challenge on Bruno Aguiar.
And Hearts eased to a victory that renders their final-day visit to face Rangers at Ibrox meaningless as far as the final placings are concerned.
Hearts: Gordon, Neilson, Fyssas, Pressley, Tall, Aguiar (Brellier 90), Cesnauskis, Hartley, Skacel (Mikoliunas 66), Jankauskas, Bednar (Pospisil 88).
Subs Not Used: Banks, Berra, Wallace, Barasa.
Goal: Hartley 54 pen.
Aberdeen: Langfield, McNaughton, Anderson, Diamond (Dempsey 66), Byrne, Nicholson, Severin, Foster, Smith, Lovell (Mackie 33), Crawford.
Subs Not Used: Esson, Considine, Macauley, Maguire, Griffin.
Sent Off: Severin (79).
Booked: Diamond, Mackie.
Ref: S Dougal