River Plate hit the front through Manuel Lanzini just before the hour-mark on Sunday at La Bombonera but Riquelme's pin-point free-kick 10 minutes later sent the home fans into ecstasy as the hosts looked set to stretch their unbeaten run in the Superclasico to five games.
But with four minutes remaining, Ramiro Funes Mori headed a corner into the net, silencing the home crowd and giving River their first competitive win over Boca since 2010.
River's victory took them to 17 points in fourth in the Argentina Primera Division, just one point adrift of leaders Colon, who suffered their first defeat in nine matches.
Colon lost 1-0 at Arsenal on Sunday with Milton Caraglio scoring the goal for the home team, getting on the end of Matias Zaldivia's long pass to beat visiting goalkeeper German Montoya at the near post.
In Buenos Aires, River survived a first-half barrage from Boca with Marcelo Barovero making several good saves for the visitors.
The home side were left to rue their first-half misses 13 minutes after the break when Lanzini burst onto Teofilo Gutierrez's pass and finished past Agustin Orion.
But Boca struck back in the 68th minute with Riquelme's direct free-kick curling over the wall and into the net off the underside of the bar as Barovero looked on.
In what is expected to be his last Superclasico, Riquelme, 35, celebrated his goal with unbridled passion but it meant little in the end, as Mori's header from Lanzini's corner saw the visitors triumph.
The loss was Boca's first in fiver Primera Division matches and left them in 12th in the table on 12 points.
With Colon also losing on Sunday, three clubs moved within a point of the leaders.
Velez Sarsfield thrashed Gimnasia La Plata 5-1 on Saturday to claim second with a plus six goal difference, while Estudiantes (plus three) drew 0-0 with Olimpo to take third ahead of River Plate (plus two).
Godoy Cruz missed the opportunity to take top spot as they were held to a scoreless draw by All Boys and finished round 10 on 16 points, ahead on goal difference of Lanus, who defeated Rosario Central 2-1.
Emanuel Mas headed in an equaliser in second-half stoppage time to earn a 2-2 draw for San Lorenzo at Tigre and Newell's Old Boys gave up a lead to draw 1-1 with Quilmes.
In other results, Atletico Rafaela drew 2-2 with Racing Club and Belgrano completed a scoreless draw with Argentinos Juniors.
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.