Is the vote value unknown in that context? If yes, I could provide a solution in pseudo code:
The dataset is unique with user_id and story_id because the user can´t vote multiple times. So give a marker value as parameter. Let´s say -20.
unvote (user_id, story_id, -20)
function userid (user_id, story_id, vote_value)
{
if {vote_value = -20}
vote_value = SELECT vote_value FROM pligg_votes WHERE user_id = user_id AND story_id = story_id
else {}
.... (function as it is now)
}
My other hot topics:
v9.5: Submit step 3 related sidebar v9.5: Comments to discarded stories