Last man Harry Gurney hit the winning run to take Nottinghamshire 11 points clear at the top of the LV= County Championship after a thrilling pursuit of 170 sunk relegation-threatened Lancashire by one wicket inside three days at Liverpool.
Captain Chris Read's unbeaten 40 off 66 balls was crucial as he shared in stands of 37 for the sixth wicket with Rikki Wessels and 44 for the eighth with Luke Fletcher.
Fletcher also played a hugely significant role in a day which saw 17 wickets fall as he claimed three in five balls and hit 18 to advance Notts from 119 for seven.
Fletcher fell to Kabir Ali, who then had Andre Adams caught at long-leg with the scores level, before Gurney sealed victory off Glen Chapple with the first ball of the 51st over. Notts started their chase with 53 overs left in the day.
While Notts are 11 clear of Somerset in second and 16 ahead of third-placed Yorkshire, who have a game in hand on both, Lancashire are 11 points from safety having played a match more than their fellow strugglers.
Usman Khawaja and Ashwell Prince, who made 53 and 45 respectively, advanced Lancashire from 55 for two at the start of play to 99 before left-arm England one-day bowler Gurney expertly used the extra bounce on offer to get among the wickets as the hosts were bowled out for 205.
He had Khawaja caught behind, Steven Croft held at point, Prince lbw and Tom Smith caught at second slip in the space of 29 balls as Lancashire fell to 140 for six in the 35th over.
Fletcher struck in the fourth over after lunch when he had Chapple caught at second slip, before bowling Jos Buttler and dismissing Kyle Hogg caught in the cordon with the first two balls of the 47th over.
Stephen Parry, who replaced England Test squad member Simon Kerrigan in the XI, and Kabir added 36 for the last wicket to get Lancashire up above 200 and give themselves something realistic to defend.
The hosts struck twice in the early stages of the Notts chase as Chapple had Alex Hales caught at second slip and Smith trapped Steven Mullaney lbw, leaving the score at 41 for two.
And when Smith picked up his 47th and 48th wickets of the season with the first and last balls of the 16th over, having James Taylor caught behind and Michael Lumb lbw, Notts were 53 for four and still 117 away.
Samit Patel was held at point off Chapple in the second over after tea with the score on 79 before Read and Wessels united for the sixth wicket to steady things.
Wessels, however, was the first of two wickets to fall in successive overs to Hogg and Chapple as Lancashire edged ahead for the first time with their visitors at 119 for seven in the 32nd, needing 51.
Wessels punched Hogg to cover and Peter Siddle was caught at point off a top-edged pull at Chapple.
Read and Fletcher steadily advanced before the latter was caught at third slip off Kabir, who then picked up his 500th first-class career wicket by dismissing Adams.
"It was relief in the end," said Notts captain Read.
"It should have been excitement needing only seven runs with three wickets still in the shed but in the end when Harry Gurney hit those runs I was flapping.
"He shouldn't have been on strike and I was not particularly happy with losing two wickets in that penultimate over. It was relief but that's the best shot I have ever seen Harry Gurney play. I'll remember that for the rest of my life."
Lancashire assistant coach Gary Yates said: "There is natural disappointment at the final result, but I'm proud of the way the team played if I'm being honest.
"There wasn't a lot between the two teams. We had some really good fighting spirit.
"We felt that if we could set a target of 200 or just above, that might be the difference. In the end it was a great effort to try and defend 170.
"The partnership between Fletcher and Read was a long one and Fletcher took a bit of the sting out of our momentum at the time. Although we got two wickets at the end, it was just a little bit too late.
"It was a very fine line in victory and they scored one more run than us at the end of the day."