Hibernian 2 Dunfermline Athletic 1
It moved the Edinburgh club to within a point of third place in the SPL, but for long periods it looked as if Dunfermline would hold on for a point.
Then Riordan exchanged passes with Garry O'Connor to steer a shot high into the net to seal the victory.
The home side just about shaded it in an engrossing contest in which both sides had chances to score in the final minutes.
Hibs had the ball in the net after only 75 seconds when Riordan chased an O'Connor pass and shot past Derek Stillie, but the linesman's flag was up and the celebrations were cut short.
Guillaume Beuzelin almost scored a spectacular opener after a great run from O'Connor but snatched at his volley and it was well over the top.
The French midfielder had his afternoon cut short when he went down in the centre-circle after a late challenge from Gary Mason, which saw the Dunfermline midfielder yellow-carded.
Hibs looked dangerous every time they went forward and O'Connor stabbed a ten-yard shot wide after a wayward shot from Craig Rocastle had broken into his path.
Dunfermline did not have an effort on goal until the 22nd minute when Scott Thomson curled in a 25-yard free-kick but it was rising all the time and Simon Brown was untroubled.
Steven Whittaker then joined the Hibs attack and his well-struck left-foot shot curled just a yard over the crossbar.
Stephen Glass came closest to the breakthrough four minutes from half-time.
Dean Shiels' tenacity won the ball out on the left and fed Riordan who picked out Glass at the back post.
The midfielder's header looked a goal all the way but Scott Wilson stuck out a boot to deflect the ball onto the post and the Pars scrambled the ball clear.
It took a great one-handed save from Simon Brown to prevent Andy Tod giving Dunfermline a 48th-minute lead.
Tod met Barry Nicholson's cross and his downward header looked a certain goal but Brown dived to his right to push the ball for a corner.
Hibs had to make a goalkeeping change ten minutes into the second half when Simon Brown was injured and Alistair Brown replaced him.
O'Connor then had the miss of the match when a Greg Ross interception broke to him but he shot against Stillie.
Glass opened the scoring with a 25-yard free-kick which just eluded Stillie as it sped into the net after 65 minutes.
Dunfermline were level two minutes later when substitute Ian Campbell crossed for Tod to head home.
However, Hibs finished strongly and Riordan and Sam Morrow both missed chances before Riordan finally secured the points at the death.