Warwickshire 158 (Thomas 3-29) and 427 for 9 (Chopra 108, Ambrose 65, Clarke 61*, Evans 55, Leach 5-63) drew with Somerset 406 (Petersen 136, Buttler 119*) and 266 for 4 declared (Compton 105*, Kieswetter 59*)
Dougie Brown hailed Warwickshire's "incredible strength of character" as their tenth-wicket pair survived for 21.1 overs to deny Somerset victory at Taunton.
Rikki Clarke and Oliver Hannon-Dalby resisted for the last 78 minutes of the match to help the champions escape with a draw and leave Somerset, winless after their first three games, sitting sixth in the Division One table.
In a pulsating finish to a high-quality game that should underline the attraction of county cricket, the Warwickshire pair resisted - with a mixture of luck, application and pure determination - an impressive spell of surprisingly quick bowling form 19-year-old Jamie Overton as Somerset pressed for victory.
In the end, though, the lack of experience in the attack showed - Warwickshire were not forced to play at enough deliveries in the final hour - and Clarke, in particular, provided another demonstration of his growing maturity and reliability in batting out the final 45 overs of the game.
"They showed exactly what Warwickshire is about," Brown, Warwickshire's director of cricket, told ESPNcricinfo afterwards. "They showed that we play as a team and for the team and we never accept defeat. We have something at Edgbaston that you just can't buy: it's called team spirit and we leave here taking great encouragement from this performance."
Somerset may consider themselves unfortunate. Oliver Hannon-Dalby was inexplicably reprieved by umpire Nick Cook after he had clearly edged the impressively hostile Jamie Overton to the substitute keeper Jos Buttler with 11 overs to go and the umpires also made the bewildering decision to take the players off for two overs for bad light just as the sun came back out from behind the clouds. It cost Somerset two overs.
But they will also rue some self-inflicted errors. Somerset spurned at least four catching opportunities on the final day - Clarke was the beneficiary on two occasions; one a straightforward chance to James Hildreth at slip - and must also reflect on the wisdom of not enforcing the follow-on towards the end of the second day of the match.
Somerset led by 248 runs after the first innings but, instead of asking his bowlers for another burst on the second evening, with 13 overs left in the day, Trescothick instead decided to extend his side's advantage. He might also have declared Somerset's second innings earlier.
"It was a brilliant advert for the county game," Trescothick said phlegmatically afterwards. "It was a great game and it was on TV.
"You always reassess your decisions, but I don't regret the follow-on decision at this stage. The bowlers were tired and the pitch was flat. No-one means to drop catches, but we missed some crucial opportunities and that cost us."
Warwickshire also deserve much credit. While the pitch remained comfortable for batsmen and the bowling attack was somewhat green - it included two teenage seamers and a 21-year-old spinner - to resist for 144 overs was remarkable. It was the highest score Warwickshire have ever made in the fourth innings of a first-class match and is believed to be their longest ever fourth-innings in terms of overs faced.
It says much for the positive outlook in the Warwickshire dressing room that, despite chasing a target of 515, they did not abandon victory hopes until their sixth wicket fell. That ambition may have counted against them, though, when Tim Ambrose's fluent half-century was ended when he top-edged a pull - Hildreth caught it running back from slip to within 10 yards of the third man fence - and Laurie Evans' excellent three-and-a-half hour show of defiance was ended when he chased a wide one and edged a cut to slip.
Earlier Varun Chopra - missed on 94 when he drove a tough caught-and-bowled chance back at Alfonso Thomas - completed the 12th first-class century of his career and Chris Woakes, batting at No. 6 in this game (Warwickshire utilised a nightwatchman in their second innings) with an idea to his potential role with England, composed a pleasing 42. They still only finished 88 runs short.
With so much to admire, then, it is a shame that the drama was overshadowed by some disappointing umpiring. While everyone accepts that human frailty comes with the territory, the standard of decision-making in this match was so low that it threatened to compromise the meaningfulness of the encounter. So many important decisions were wrong - some of them far from difficult - that the game took on an element of chance.
Quite apart from the men given out incorrectly - there were several but Nick Compton, William Porterfield and Chris Wright, given out lbw on the last day to a ball that would have bounced over the stumps, could feel particularly aggrieved - the umpires also made a horrendous mess of the light issue.
First they insisted that play continue in the rain - Woakes was bowled in remarkably gloomy conditions - and then took the players off just as it stopped and the light brightened. By the time Cook, by some distance the worse of the two umpires, utilised the TV coverage to review two appeals for catches - neither was out - it appeared that even he had lost confidence in his decision-making.
At least Jack Leach will remember this game with more affection. Leach, 21-year-old and playing his third Championship game, used to be employed to park trolleys in a branch of Sainsbury's supermarket in Taunton, but here took his maiden five-wicket haul as he was rewarded for his control and persistence; 24 of his 44 overs were maidens. It seems safe to assume he left those trolleys in good areas.
But while Leach demonstrated admirable control, he is not a big turner of the ball - he was reliant on the foot-holes when bowling Chopra, sweeping, behind his legs - and he lacked the bite to inflict the fatal blow. While delighted with his own performance, he admitted the result "felt like a loss" afterwards.
"We batted badly in our first innings," Brown said. "But we bowled well in both innings against a batting line-up that is Test class from one to six and we batted well in the second innings."
It seems neither of Warwickshire's last-wicket heroes will play their next game. Clarke, who pulled a hamstring, will not play in the Championship match against Sussex starting on Wednesday, while Boyd Rankin will come in for Hannon-Dalby. Jonathan Trott and Ian Bell will also play.
Craig Kieswetter, who was forced off the field at lunch having sustained a blow to his right-hand when standing up to the stumps off Peter Trego, is also an injury doubt for the next match and will require some sort of scan to ascertain the extent of the damage. In Buttler they possess a remarkably keen and able deputy.
George Dobell is a senior correspondent at ESPNcricinfo