The Bears resumed on 131-8, needing a further 53 to pull off an unlikely win in a dramatic game at Taunton.
But, after 21 wickets had fallen to spin on the first two days, seamer Lewis Gregory made the breakthrough.
He removed Chris Wright before Jack Leach had Josh Poysden caught by Marcus Trescothick to bowl them out for 152.
Leach ended with 6-42, matching fellow spinner Dom Bess's achievement of taking eight wickets in the match.
Poysden's dismissal left Rikki Clarke stranded on 55 - only the second half-century of the match - Warwickshire's hopes having effectively expired when Wright was caught behind off Gregory to end their 86-run ninth-wicket stand.
Clarke scraped a further five runs before last man Poysden edged Leach to slip, enabling Trescothick to rewrite two county records.
His seventh catch of the match equalled the record of seven in a match by a Somerset outfielder, set by Chris Tavare in 1989.
It also took his career tally to 394, beating the 79-year-old record of former Somerset and England all-rounder Jack White.
Somerset's fourth win of the season lifted them to second place in Division One, two points behind Middlesex, who have collected four bonus points against Nottinghamshire but slipped to 48-3 in pursuit of 235 at Trent Bridge.
Somerset head to Headingley next week to face title contenders Yorkshire before hosting Notts in the final round of games starting on 20 September.
One-Day Cup finalists Warwickshire, with only one match left, are left in relegation danger. They now play Lancashire, another team still not safe, in their final Championship game at Edgbaston, which begins three days after their white-ball trip to Lord's to face Surrey.
Somerset's victory could be subject to investigation by the England and Wales Cricket Board, for whom pitch liaison officer Phil Whitticase was present after 21 wickets fell on the first day on a used pitch.
Somerset captain Chris Rogers told BBC Radio Somerset:
"I brought Lewis Gregory on because I felt the batsmen were getting into a rhythm against our spinners. I just had a bit of a feeling that a change of pace might cause problems.
"Such decisions often come down to luck and it's nice when they go your way. It makes you look like you know what you are doing.
"It wasn't the sort of pitch I would want to spend my career batting on. Each ball behaved a bit differently and that creates questions in the minds of batsmen, which makes them tentative.
"But our spinners are bowling well and I'd take the same sort of wicket in our final home game against Notts if it means winning the title."
Warwickshire captain Ian Bell told BBC WM:
"The pitch wasn't dangerous in any way so there was no cause for complaint. The ECB want wickets that turn, but I don't think that sort of surface is great, even for the development of spinners.
"It may bring them more wickets, but they will then find themselves bowling on slow, low tracks if they step up to international level.
"It's disappointing, because we are now right in the mix at the wrong end of the table. The game summed up our Championship cricket this season. We were good in spells, but not consistent enough.
"But we have a big final at Lord's to look forward to so we can't afford to dwell on this. But, whatever happens, we need to look at our four-day cricket because there have been problems stretching back to the end of last season."
Somerset emerged as contenders for a first County Championship title as they sealed a 31-run win over Warwickshire inside the first hour on day three.