Stormzy, who seemed overwhelmed when he won best British male and best British album for Gang Signs and Prayer, also closed the show and criticised the PM's handling of the Grenfell tragedy.
Sheeran didn't go home empty-handed - he was given the global success award.
But the night belonged to Stormzy, who held his head in his hands as he walked to the stage to accept best male, and fell to the ground when he was named winner of British album.
He told the crowd Gang Signs And Prayer was "the hardest thing" he had done and gave "all the glory to God".
He said: "I've never worked on something like this in my life. We made something I feel that is undeniable, that I can stand by today."
The star also used a freestyle between songs at the end of the show to deliver a blistering criticism of the prime minister's handling of the Grenfell Tower fire.
"Yo, Theresa May, where's that money for Grenfell?" he rapped. "What, you thought we just forgot about Grenfell?"
A Downing Street spokesman said the government had committed more than £58 million to deal with the aftermath of the tower block blaze.
Ed Sheeran had the biggest commercial success of 2017, but won't have begrudged Stormzy his wins - before the ceremony, he said he wanted the Croydon rapper to win best album.
"I think he made the album of the year, personally," Sheeran told BBC 5 live. The pair performed together at last year's show on a remix of Shape Of You.
Gang Signs And Prayer was the first grime release to win the Brit for best album, 15 years after the genre - a British take on hip-hop - emerged from east London.
Brit Awards key winners
- British album: Stormzy - Gang Signs and Prayer
- British female: Dua Lipa
- British male: Stormzy
- British group: Gorillaz
- British single: Rag 'N' Bone Man - Human
- See the full list of winners and nominees
Dua Lipa, the 22-year-old British-Kosovan pop singer, was the only other artist to walk away with two awards at the ceremony, in London's O2 Arena.
In one of the night's most touching moments, she took her younger brother and sister on stage as she accepted her award for best breakthrough and told them, with millions watching: "I love you."
You might also like:
Dua Lipa told 5 live afterwards that it was "a spur of the moment thing", adding: "Everything I do is to show my little brother and sister that they can do whatever they put their minds to, and I guess I want to be a good role model for them."
Earlier, she used her acceptance speech for best British female to send a message of female strength.
"I want to thank every single female who's been on this stage before me that has given girls like me - not just girls in the music industry but girls in society - a place to be inspired be, to look up to, and that have allowed us to dream this big," she said.
"Here's to more women on these stages, more women winning awards and more women taking over the world."
Dua Lipa was raised in the UK but at the age of 13 she moved with her parents to their former home of Kosovo.
Two years later, she returned to London alone to pursue music, while scraping a living in bars and pubs. Her efforts were rewarded with five Brit nominations.
She was one of many artists who wore white roses or rose badges on the red carpet as a mark of support for the Time's Up and Me Too movements.
Ellie Goulding, who presented best international female, had a dig at the Grammy Awards and their boss Neil Portnow, who said women needed to "step up" in the music industry.
The British star said: "We're very proud to be women and I think we can all agree we've been stepping up for years."
Meanwhile, in a poignant tribute to the victims of last May's Manchester Arena attack, Liam Gallagher performed a rendition of Oasis hit Live Forever, accompanied by cello and acoustic guitar.
He was introduced by fellow Mancunian Gary Barlow, who paid tribute to the 22 "innocent, music-loving people" who lost their lives.
Ariana Grande had been due to perform that section of the show, but was unable to travel to London "on doctor's orders".
Gorillaz were named best British group and their leader Damon Albarn used his acceptance speech to send a message about Brexit.
"This country is - believe it or not - quite a small, little thing, right, but it's a lovely place and it's part of a beautiful world," he said. "But what I want to say is, don't let it become isolated, don't let yourselves become cut off.
"Considering our size we do incredible things in music, we've got a real spirit and a real soul and don't let politics get in the way."
Analysis - BBC music reporter Mark Savage
On the red carpet, Ed Sheeran said he wanted Stormzy to win best album. Lo and behold, the grime star crept up and stole the award off him.
Not that Stormzy didn't deserve it. Gang Signs & Prayer is a huge, uncompromising album - one that redefined what grime could be as it veered from spittle-flecked free-styling on Big For Your Boots to the gospel-inspired devotional Blinded By Your Grace.
The victory notably comes two years after he blasted the Brits as "embarrassing" and "so white", which led to a shake-up in the ceremony's voting committee. But it was his artistry, not politics, that swayed voters.