(CNN) The US Open villain is heading to the semifinals.

Daniil Medvedev, who has played the role of the bad guy during this fortnight, overcame Stan Wawrinka 7-6(6), 6-3, 3-6, 6-1 on Tuesday afternoon. His next opponent is a major surprise: It's 78th-ranked Grigor Dimitrov, who shocked No. 3 Roger Federer in five sets in the night session.

Medvedev has amassed fines of $19,000 this tournament, for -- among other things -- verbal abuse, snatching a towel from a ballperson and flipping the middle finger to the crowd in the third round against Feliciano Lopez.

The Russian trolled the aforementioned crowd with his on-court interview after downing Lopez and a chunk of spectators with his victory dance a round later against Dominik Koepfer.

According to the lanky 23-year-old, their energy -- even if they haven't rooted for him -- has kept him going despite an array of injuries.

The fifth seed said a right shoulder injury almost ruled him out against Koepfer while his abductors are sore and cramps surfaced.

Never going this far previously at a grand slam, combined with a successful but tiring summer that saw Medvedev make three finals in consecutive weeks in Washington, Montreal and Cincinnati, have taken a toll.

Left leg taped up

Then Tuesday he got his left leg heavily strapped at 4-3 in the first set. He said it was because he injured his quadriceps in the first game.

Yes, in case you were wondering, by that time he'd been booed upon entering the court, and cheers came when he hit double faults, although the atmosphere wasn't as charged as in Medvedev's previous two rounds. A largely muted Medvedev contributed to that.

Medvedev grabbed an early break advantage against Wawrinka before the trainer's visit ahead of the eighth game.

On the next changeover, at 5-4, the tape came off.

Broken at 5-5, it felt like Medvedev would pull the plug at any moment, especially if he ended up dropping the set.

But Wawrinka -- who lost their only other encounter at Wimbledon in 2017 when struggling with a knee injury that would eventually cut his season short -- couldn't take advantage, even after overturning a 3-0 deficit in the tiebreak.

Wawrinka later held a set point on serve at 6-5 in the tiebreak, crushing a first serve.

He must have thought he'd won the point straight away, but Medvedev's floated return stayed in.

As the rally unfolded, Wawrinka missed a forehand wide.

Medvedev won the next two points to claim the first set and thus got a massive boost.

Took a toll on Wawrinka

The opposite happened to his opponent. Reeling, Wawrinka was broken early in the second to trail 3-1 and Medvedev had a spring in his step.

Hitting drop shots in the first set at times to shorten rallies -- Medvedev possesses great touch, combined with power -- they largely went away in set two.

Medvedev suffered a letdown to start the third, falling behind 3-0, yet Wawrinka almost let him off the hook at 5-3.

JUST WATCHED One-on-one with Stan Wawrinka (2016) Replay More Videos ... MUST WATCH One-on-one with Stan Wawrinka (2016) 02:18

Earning a set point and working Medvedev all around the court, Wawrinka's forehand sitter went a yard wide.

Wawrinka would eventually have to save four break points before converting on his third set point.

The fourth set followed the pattern of the first three: A break came early. It was to Medvedev, for 2-0.

In the next game, he flashed defense that would make Rafael Nadal proud, striking a squash-like forehand on break point to force a Wawrinka volley error.

That was Wawrinka's last realistic chance.

"I didn't start well," Wawrinka said. "I never really find the right rhythm. I wanted to find between staying back and being offensive. Didn't serve so well.

"He was playing well. He was there when he need it, and he was the better player today."

'I felt the way I won was quite ugly'

Medvedev then barely celebrated upon winning -- forget the dance -- and said he would try his best to be 100% for the semifinals.

"I felt the way I won was quite ugly, because that's what I had to do," Medvedev said.

"I am still really painful in my leg. I knew I have to play without rhythm. Some games I have to not run to relax my leg. I was hitting full power, then suddenly I was doing dropshots in the middle.

"I knew I should not give him any rhythm. In crucial moments maybe it will make him miss. That's what has worked.

"Of course, I would prefer to win in a normal way with a normal tennis game, but that's how I won. Hopefully physically I will feel better normally, yes."

Having two days off, instead of the usual one, could make all the difference.

"I'm feeling really lucky about it because I didn't know this before the match or during the match," Medvedev said about the amount of time he gets to recover. "As soon as I went out of the court, somebody told me that, now you have two days. I was like, 'Really?'

"I didn't know. I thought it was going to be normal, one day off, you go to play. That's huge advantage regarding what happened to my leg. I think, as I say, I don't want to say anything yet, but I think it should be OK."

He finally drew some applause from the fans when it ended for his impressive display. When asked if feels like he is friends again with the fans in New York, the Russian responded, "Hopefully. It's not for me to decide. As I said in the post match, even after the previous round, what I got I deserved. Usually I'm not like this, as I was in the third round match. I'm not proud of it. I'm working to be better.

"Hopefully I can show the bright side of myself."

Wawrinka doesn't think Medvedev will win US Open

Wawrinka was asked if Medvedev could win the US Open.

"He can, but I don't think he will," the 2016 champion said. "I think it's going to be really difficult. But that's just my opinion."

As to why?

"Because he looks to start to be tired, and he has to beat some more tougher player in the semifinal, Roger or Grigor, and then in the final," Wawrinka said. "But again, he's showing last few weeks that anything can happen with him, so for sure he's going to have a shot. He just need two more matches."

With Federer losing, perhaps it could happen. Neither Medvedev nor Dimitrov have reached a major final.