England had led for much of the Pool A game until a late Dan Biggar penalty, one of 23 points for the inspired fly half, put the Welsh ahead with only a few minutes remaining.
But there was still time for England to win a late penalty -- only for captain Chris Robshaw to decline the chance of three points for a successful kick to tie the scores -- and go for a try from a line-out.
This tactic had successfully worked for Japan in its sensational win over South Africa last weekend, but this time it backfired, with England forced back and Wales able to clear its lines.
Robshaw came under immediate fire from experts and on social media for a gamble which backfired, but in truth earlier mistakes by his team, which had dominated for much of the match and led by 10 points at halftime, were the decisive factor.
"The call came down to myself, we wanted to go for a win, unfortunately it didn't come off," Robshaw later admitted.
The victory was all the more unexpected because Wales had gone into the crunch match missing key players such as Leigh Halfpenny through injury and saw backs Scott Williams, Liam Williams and Hallam Amos forced off during a bruising encounter.
A first half try from Jonny May and 20 points from the boot of recalled Owen Farrell looked to be enough, but Wales stayed in touch thanks to Biggar, standing in for Halfpenny with the kicking duties.
Warren Gatland's team drew level after Gareth Davies picked up Lloyd Williams' brilliant cross-field kick to cross, the try converted by Biggar.
With England stunned, it gave away another penalty on the halfway line and Bigger struck the decisive points from long range.
Defeat left England coach Stuart Lancaster "gutted" and his team must beat Australia next Saturday to realistically keep alive its hopes of reaching the knockout stages as one of the top two teams in a tough pool.
Australia warmed up for that clash Sunday by running in 11 tries to beat minnows Uruguay 65-3.
Wales, with a heavy injury list, next faces Fiji, a team which beat them in the 2007 finals, before it grapples with the Wallabies in a match which could decide who tops the section.
Earlier Saturday, JP Pietersen scored a hat-trick of tries as South Africa hit back after its stunning 34-32 defeat by the Cherry Blossoms of Japan to beat Samoa 46-6 in Pool B.
But the victory came at a heavy price with the Boks captain Jean de Villiers forced off with what was later confirmed as a broken jaw, meaning he will miss the remainder of the tournament.
The bonus point win took South Africa temporarily to the top of the pool,but Scotland regained the leadership with a hard fought 39-16 win over the United States in Leeds Sunday after trailing 13-6 at the half.
The Scots, who beat Japan in midweek, continued their fine play with five tries, including the 100th try of the 2015 competition, scored by New Zealand-born Sean Maitland.
It left Scotland on 10 points after two bonus points wins, three clear of South Africa ahead of a crunch clash next Saturday.
Later Sunday, Ireland beat Romania 44-10 before a world record crowd for a Test match of 89,267 at Wembley to top Pool D.
Tommy Bowe and Keith Earls scored two tries apiece with Chris Henry and Rob Kearney also crossing for the Six Nations champions.