Steven Patterson and Matt Fisher shared 78 runs inside 28 overs either side of lunch to secure a two-wicket victory after Bears off-spinner Jeetan Patel (six for 50) played a big part in limiting the hosts to 96 for seven in pursuit of 175.
Yorkshire, who began the day on 56 for three, claimed 21 points from their fourth win of the campaign as Patterson cut Chris Wright for four to move to 44 not out off 78 balls.
A relieved head coach Andrew Gale, said: “It’s a massive win for us. We’re not home and dry yet, but as daft as it sounds, I think you probably still finish second.
“It’s that bizarre. We just have to go down to Chelmsford and continue some of the good work. I feel like we have played some really good cricket over the last three weeks. Had we played like that for the majority of the year, we wouldn’t be where we are.”
Patel picked up the first three wickets of day four, including key man Gary Ballance for 21 first. He trapped the left-hander lbw pushing forwards as the hosts fell to 71 for four.
Patel, who bowled unchanged from the Kirkstall Lane End, claimed his fourth wicket of the innings when Ian Bell took a fine catch diving to his left at leg slip to help remove Jack Leaning. Tim Bresnan then holed out to deep mid-wicket off the New Zealander in the next over to record his sixth duck of the Championship season.
Ryan Sidebottom then had Andrew Hodd caught at slip low down by Patel and at that stage, Yorkshire still needed 79 more with only three wickets left.
But Patterson and Fisher lifted the mood among the Headingley faithful, with grumbles soon turning to cheers. Patterson was particularly strong on the back foot through the off side as he and Fisher helped to take the score to 141 for seven at lunch, needing 34 more.
Both men have endured frustrating seasons. This was Fisher’s first appearance of the season, and he celebrated with five wickets in the first innings and also hit 37. Patterson has been left out of the side at times, but he impressed with four wickets in the second innings.
Their half-century stand came up inside eight overs immediately after lunch as Patterson cover-drove Patel for four and got three much squarer shortly afterwards. Warwickshire conceded 40 extras, including two four byes off Patel as the target became six.
Fisher finished with 15 as he was caught at leg slip at the death before Yorkshire’s Ryan Sidebottom, injured for this match, was clapped on to the field by his team-mates in a guard of honour after victory had been confirmed.