The three-time Grand Slam winner failed to convert four set points in the first set before the Swede triumphed in two hours and 50 minutes.
The match was full of momentum swings, with the 35-year-old capitalising on Ymer's own physical issues, appearing to cramp in the second set, to level it up after winning five of the final six games of the set.
But 23-year-old Ymer regained his composure and physical state to race away with the third set for victory, rounding out 37 winners for the match, leaving Murray frustrated.
"It was disappointing obviously," Murray told reporters. "I thought there was some good tennis in the first set. After that, both of us were struggling a bit physically. The level of the tennis was not great.
"Obviously [I] had chances in the first set to close that out. I had set point at 6-5, then... three in the tie-break and didn't get it.
"I think he seemed like maybe he was cramping a little bit in the second set, but recovered absolutely fine after the break at the end of the [second] set.
"Went off to change and cool off a little bit, and he recovered well for the third, whereas I didn't really. Yeah, just frustrating."
The first-round exit comes after Murray lost in the Hall of Fame Open quarter-finals in Newport to Alexander Bublik when he cramped up in hot and humid conditions.
"Struggled a little bit the past two tournaments with that," he said. "I need to have a little look at that with my team and maybe see why that is, make a few changes."
French veteran Adrian Mannarino took care of Bradley Klahn 6-2 6-4, while Jack Draper beat Stefan Kozlov 7-5 6-2 to set up a second-round date with top seed Andrey Rublev.
World number 112 Benoit Paire also triumphed in the first round on Tuesday, getting past Peter Gojowczyk 7-5 6-4.
Kyle Edmund, Jack Draper, Borna Gojo, Dominik Koepfer, J.J Wolf and Denis Kudla also were victorious, with Alexei Popyrin progressing after a walkover against Wu Tung-lin.
World number 20 Musetti is still just 20 years old, making him the third-youngest player inside the top-40. The only younger players are 19-year-olds Carlos Alcaraz (world number two) and Holger Rune (world number nine).
The talented Italian has two ATP Tour titles to his name, but none outside of Europe, and he will hope to change that after he advanced to the quarter-finals in Buenos Aires.
Musetti will play Peru's Juan Pablo Varillas next after he prevailed 6-4 6-4 against former world number three Dominic Thiem.
Fifth seed Francisco Cerundolo did his part to set up an all-Argentine quarter-final clash after dominating Jaume Munar 6-2 6-1, but compatriot Diego Schwartzman could not hold up his end of the deal, falling 6-1 6-3 to Spain's Bernabe Zapata Miralles.
Meanwhile, world number seven Taylor Fritz made a winning start to his Delray Beach Open campaign, defeating Ecuador's Emilio Gomez 6-4 6-3.
Fritz will play France's Adrian Mannarino in the quarter-final after the 34-year-old veteran eliminated 24-year-old American J.J. Wolf 7-5 6-2.
Second seed Tommy Paul was too strong for Denis Kudla in a 6-3 6-4 triumph, and he will play Radu Albot for a place in the semi-final after the Romanian emerged the 6-4 6-4 victor against Australia's Aleksandar Vukic.
All four Frenchmen in action on Monday were knocked out in Lyon, including 2018 finalist Gilles Simon.
Aljaz Bedene knocked out the world number 68 in straight sets, two breaks of serve in each enough to secure a 6-2 6-3 triumph after one hour and 13 minutes on court.
Sebastian Korda overcame both Pierre-Hugues Herbert and the rain to progress to the second round, a 7-6 (7-5) 6-4 triumph wrapped up quickly following a delay.
Having been 5-4 ahead in the second set when play was halted, Korda clinched victory on his first match point upon the resumption, in the process snapping a run of four successive defeats on the ATP Tour.
Cameron Norrie will take on top seed Dominic Thiem next after his 7-5 6-3 win against Corentin Moutet, while Ugo Humbert let slip a one-set lead as he was beaten by Yoshihito Nishioka.
Meanwhile, at the Geneva Open, there was a maiden victory for French teenager Arthur Cazaux as he came out on top against compatriot Adrian Mannarino.
The 18-year-old held his nerve in a decider despite this being his first tour-level contest; Reilly Opelka or Pablo Cuevas will be next up in the event.
As for Federer, he will begin his campaign on Tuesday, the 39-year-old having played just two matches so far this year after undergoing two knee operations in 2020.
The Swiss superstar now knows he will be up against Pablo Andujar, who overcame Australia's Jordan Thompson in straight sets.
Tennys Sandgren saw off Salvatore Caruso 6-3 6-4, while Dominik Koepfer came through a tight tussle with Benoit Paire that spanned two hours and 39 minutes.
The 20-year-old American, who took a set off Novak Djokovic and rattled the world number one at the US Open, is shaping up as potentially his country's biggest hope for the future in the men's game.
Californian Brooksby crushed Spain's world number 44 Alejandro Davidovich Fokina 7-5 6-0, and second seed Schwartzman awaits after the Argentinian took down another 20-year-old American, Brandon Nakashima, scoring a 6-4 6-2 quarter-final win.
Schwartzman is the man who ended Andy Murray's hopes at the tournament in Antwerp.
Brooksby, who had to win two qualifying matches to reach the main draw, said: "Tomorrow will be a great match. I'm really looking forward to it. I'll get some rest tonight and get ready to battle again tomorrow."
The other semi-final will see Italian top seed Jannik Sinner take on South African seventh seed Lloyd Harris following their respective straight-sets wins over Arthur Rinderknech and Marton Fucsovics.
There will be an all-Russian semi-final at the Kremlin Cup in Moscow, after Aslan Karatsev and Karen Khachanov won through to the final four.
Second seed Karatsev sank the hopes of Frenchman Gilles Simon, breaking serve five times on the way to a 6-4 6-3 win, while third-seeded Khachanov edged out Australian John Millman. A 7-5 7-6 (7-4) grind featured 19 aces by Khachanov, the 2018 Kremlin Cup champion, who saved four set points in the second set.
Marin Cilic thrashed Pedro Martinez 6-1 6-2 to set up a tussle with Ricardas Berankis, the Lithuanian ending Adrian Mannarino's run with a 6-2 7-6 (7-1) success. Frenchman Mannarino had stunned Russian top seed Andrey Rublev in the previous round.
The fifth seed found a crucial break of serve when leading the opener 5-4 to take the first set in Kazakhstan, before winning the next three games to put himself in the ascendancy in the second.
And despite a desperate last stand to stay in the match from Djere, Rublev held serve three times with relative ease to finish off his Serbian opponent.
Eighth seed Felix Auger-Aliassime served 14 aces to Roberto Bautista-Agut's two in their first-round match, but it was the Spaniard who advanced with a 6-4 7-6 (8-6) success.
Meanwhile, world number 10 Hubert Hurkacz overcame Francisco Cerundolo in straight sets.
Adrian Mannarino, the runner-up in Astana in 2020, came from a set down to beat Stan Wawrinka – playing as a wildcard – 1-6 6-2 6-3, and qualifier Zhizhen Zhang romped to victory with a superb third set to seal a 4-6 6-4 6-1 comeback win of his own over Aslan Karatsev.
At the Tokyo Open, fourth seed Frances Tiafoe cruised into the second round with a 6-3 6-4 triumph over Yasutaka Uchiyama, one of three Japanese players who crashed out at the first-round stage of their home tournament.
Uchiyama's countrymen Taro Daniel and Shintaro Mochizuki also tasted defeat at the hands of Bernabe Zapata Miralles and Brandon Nakashima, respectively.
The Russian 14th seed prevailed 7-6 (7-4) 6-4 over Tsitsipas in one hour and 34 minutes, powering 25 winners and making only nine unforced errors, compared to the Greek's 14.
Khachanov's triumph ended a winless 0-6 head-to-head record against Tsitsipas, while it also snapped his own 23-match losing streak against top-10 opponents.
The Russian, who also made this year's Australian Open semi-finals, has qualified for four of his six tour-level events this year.
Khachanov will take on 25th seed Francisco Cerundolo in the quarter-finals, with the Argentinian fighting back to get past Lorenzo Sonego 3-6 6-3 6-2 in just over two hours.
Defending champion and top seed Carlos Alcaraz had less trouble against Tommy Paul, cruising into the quarter-finals with a 6-4 6-4 victory.
Alcaraz won the winners' count 24-9, setting up a quarter-final clash with ninth seed Taylor Fritz, as the Spanish 19-year-old chases a rare Sunshine Double, having won last week's Indian Wells Open.
Fritz progressed after getting past seventh seed Holger Rune 6-3 6-4 in 86 minutes, sending down eight aces and 22 winners for the match.
Fourth seed Daniil Medvedev played late into the evening after a lengthy rain delay in Miami, but made light work of Quinten Halys 6-4 6-2, triumphing just past 1:30am local time.
Medvedev, who is into his third straight Miami quarter-final, will face American qualifier Christopher Eubanks in the last eight after he got past Frenchman Adrian Mannarino 7-6 (7-2) 7-6 (7-5) in another rain-delayed contest.
Italian 10th seed Jannik Sinner knocked off sixth seed Andrey Rublev 6-2 6-4, advancing to face Emil Ruusuvuori after he beat Botic van de Zandschulp 4-6 6-4 7-5.
Mannarino was one of the players put in a "bubble within a bubble" in New York after being in contact with Benoit Paire, who tested positive for coronavirus.
The Frenchman's third-round clash with Zverev was delayed before he was allowed to play, suffering a 6-7 (4-7) 6-4 6-2 6-2 loss to the German fifth seed.
Mannarino explained he was ready to go on Friday before officials intervened.
"Well, I was preparing to go on court. Actually, it was like 2.30pm. We knew there was a not before 2.30pm. I was just trying to get ready, warming up with my coach. I was actually ready to go on court. It was 2.30pm or something," he told a news conference.
"The tour manager came to talk to me at this time. He explained me the situation. Obviously, the State Department of Health took over the city actually. The city actually allowed me to play with a new protocol on Sunday. Obviously the state took over this decision to say that I've been exposed to a positive case obviously, so I should be quarantined in my room and not be able to go on the tennis court and play the match.
"They told me they were trying to contact on phone some guys to see if this decision could be changed. Obviously, many efforts have been done. They told me, 'Okay, we decided to put your match not before 5.00pm'. Sascha [Zverev] agreed, which is nice. They told me, 'We're going to have a look at the situation, trying to see if we can get you on court today', which obviously they did.
"Many things might have been happening during this time. I was just trying to get ready. I said myself to be ready to go on court at 5.00pm. I told my coach if anything happens, I give him my phone, I say, 'Just try to see what's going on, I'll let you handle all these things, I'm just going to try to eat something, get ready, focus, just be prepared as if I was going on court at 5.00pm. Let's see if I'm not able to go, then I'm not able to go. But if I'm in a position to be able to play, I just want to be ready'.
"I just want to be thankful to all these people who have been trying to get me on court today. As I say, many efforts have been done. I was able to play my tennis match. I'm pretty happy about that.
"Then I heard actually around 4.30pm or 4.40pm that I've been allowed to go on court today. I needed to be prepared to go at 5.00pm, which I did. Happen what happened. Unfortunately I lost the match. But still, as I said, I'm happy I was on court."
Verdasco, the ninth seed at the ATP 500 tournament, was beaten 6-3 6-3 by fellow Spaniard Pablo Andujar on the clay in Brazil.
The 36-year-old has fallen to three straight losses, the first of which was a third-round defeat at the Australian Open.
Verdasco – the 2018 runner-up – was one of three seeds tested, but Garin survived a test against Andrej Martin.
Garin, who won the title in Cordoba earlier this month, needed more than three hours to edge Martin 4-6 7-5 7-6 (7-5).
Albert Ramos-Vinolas departed, the seventh seed falling to 16-year-old Carlos Alcaraz 7-6 (7-2) 4-6 7-6 (7-2) after three hours, 36 minutes.
Federico Delbonis advanced, while wildcard Thiago Seyboth Wild needed almost four hours to get past Alejandro Davidovich Fokina 5-7 7-6 (7-3) 7-5.
There were also upsets at the Delray Beach Open, where John Millman and Adrian Mannarino were beaten in the first round.
Millman, the fifth seed, went down to Yoshihito Nishioka 3-6 6-4 6-2 and seventh seed Mannarino fell to Kwon Soon-woo 1-6 6-3 6-2.
Frances Tiafoe, the champion in 2018, came through his opener against qualifier Emilio Gomez.
Federer was expected to come through his first match at the All England Club since losing the 2019 final to Novak Djokovic with little difficulty.
That anticipation was increased when he claimed the first set, only for Mannarino to fuel hope of a first win over Federer in their seventh meeting by taking the next two sets.
The 20-time grand slam champion had re-established a measure of control in the fourth set when Mannarino was left in agony after his knee buckled at 4-2.
Mannarino attempted to continue but conceded the injury was too much to overcome in the opening game of the fifth with the score 6-4 6-7 (3-7) 3-6 6-2.
Federer lost just five points on serve in taking the opener, though he took only one of his six break points, with Mannarino proving a significantly tougher nut to crack in the second set.
The Frenchman did not face a break point and was surprisingly dominant in the tie-break, and he carried that confidence into the third, making six unforced errors to Federer's 10.
At that point, the biggest shock of the tournament looked to be on the cards, but Federer was back to his best in the fourth.
Imperious at the net, Federer hit 18 winners in the fourth and a decider already looked an inevitability by the time Mannarino's misfortune meant the Swiss could save energy before a second-round clash with either Richard Gasquet or Yuichi Sugita.