Heart of Midlothian progressed to the fifth round of the Scottish Cup - but it was far from routine or easy.

Victory in the Edinburgh derby, defeating League Two The Spartans in the north of the city at Ainslie Park, was only secured in stoppage time, Frankie Kent powering a header into the bottom corner. Kenneth Vargas had given Steven Naismith's men the lead in the first half but James Craigen equalised with a superb strike in the second.

READ MORE: Steven Naismith Q&A: Too many passes, James Wilson Hearts debut, Shankland latest

Joel Sked provides an instant reaction:

Hearts dodge Spartans upset

There were plenty of magic of the cup elements at play at Ainslie Park. There was the big crowd, excitable home support, away fans perched on a hill, a piper piping The Spartans onto the pitch and then, of course, such is the nature of Ainslie Park, there were fans in the flats that looked over the pitch and then more resourceful ones. Some had brought a ladder to stand on a wall, while others had parked their van to give them an ideal vantage point.

On the pitch, it didn't quite live up to the 'classic Scottish Cup encounter'. Initially.

There were similarities to a lot of home games that Hearts encountered and endured at the start of the season. They had the majority of the possession, while the home side were well-organised and stubborn. More on than later. When the visitors went in front it was expected they would cruise to the next round. It was less cruisy and more laborious. The first half would have put the most insomniac of personalities to sleep. 

The second half followed a similar pattern until, out of nowhere, James Craigen popped up with a wonderful strike at the edge of the box. Spartans had not troubled all that much but the longer Hearts didn't put the game to bed they were opening themselves to trouble. And just like that, trouble came knocking at the door before walking through.

It has to be said, while Hearts were ponderous in possession, Spartans were excellent. Manager Dougie Samuel had his team incredibly well structured. His team worked ever so hard and it was clear each player understood what was expected of them. As ever, it required a good performance from goalkeeper Blair Carswell. He delivered, producing some excellent saves.

He, or his teammates, couldn't keep Hearts at bay in the end as the Premiership dodged an upset but were given an almighty scare.

READ MORE: Frankie Kent relieved as Hearts shake off Spartans equaliser to seal late win

Similar issues

Hearts have managed to build a great defensive foundation across the first half of the season. Arriving back from the winter break the hope was the team would provide more attacking entertainment for the club's support. The team have had plenty of shots but have struggled to create good chances. 

Any hope there would be an immediate fix to such problems wasn't on show at Ainslie Park. Individually players didn't step up but as a collective, there was little imagination and an increase in tempo. The ball, far too often, was moved slowly from one side to another without that injection of pace to play or an incisive pass to break the lines.

If this afternoon was anything to by, plenty of improvement in breaking down teams that sit in against Hearts is still required. 

Gordon return

After 392 days, Craig Gordon was back between the sticks for Hearts in a competitive fixture. Since that double leg break against Dundee United, he has celebrated his 40th and 41st birthdays. Hearts Stats revealed his appearance saw him become the Hearts player to feature in a competitive game in their 40s, while Hearts Heritage noted it is 7,777 days between his debut for the club and his most recent appearance. That's 21 years, three months and 15 months.

Unsurprisingly it was a largely quiet afternoon for the Hearts legend. There was an early pass out from the back which was confident and composed. He then pulled off a save which is bread and butter to him, springing to his left to make sure Callum Booth's effort made its way over the bar and as the first half progressed he found himself playing sweeper keeper, finding himself on the left wing after intercepting. 

When it came to the Spartans goal he could do little about James Craigen's excellent equalising strike.

It will be interesting to see who starts against Dundee on Tuesday night. It will likely be Zander Clark but Gordon showed his quality very much remains in an outing that was welcomed by the Hearts support.

Tagawa and Oda struggle but Vargas continues good forn

With Lawrence Shankland absent due to an illness, according to Steven Naismith, there was an opportunity for Kyosuke Tagawa to lead the line, supported by Kenneth Vargas, with Yutardo Oda on the right.

Firstly, the Costa Rican continued his fine form. He was the liveliest in the final third, wanting to get on the ball, whether it was running in behind and down the side of the home side's defence or dropping deep to get on the ball or help with the build-up. It was unsurprising that the opening goal came through a combination of Jorge Grant and Vargas, the latter meeting the former's excellent cross with a fine header, making it three goals in three games. He nearly doubled the lead when he shifted the ball and got a great effort in at goal.

But as for Oda and Tagawa. It was another afternoon of frustration. Tagawa didn't do enough to get involved and when he did most of what he did was safe. There appears to be an aggression and intensity missing from his play. He had a couple of half chances but never looked confident to finish them. With Oda, he has shown flashes of quality since arriving 12 months ago but he hasn't kicked on. It was another outing where he wasn't direct enough when he got the ball. He didn't provide his team with nearly enough. That pace and directness were on display when Dexter Lembikisa replaced him in the second half.

Lembikisa cameo

Speaking of Lembikisa the new boy, on loan from Wolves, displayed plenty of promise and enthusiasm. Whenever he got the ball his first thought was to fly down the line, which he did on several occasions. Not only was using his blistering pace to get away from his man, he provided a decent enough end product with some dangerous crosses. He was certainly one of the few positives from the afternoon in the north of Edinburgh.