Should I decline unrelated work assigned by PhD advisor? During the past years of my PhD program in biology, my advisor has developed a habit of lending my service to other labs/groups for potential collaborating opportunities. In addition to helping fellow students in the lab with their projects, I've helped a handful of other labs/groups with various data analysis and statistical testing tasks that were totally unrelated to my PhD project; I rarely got anything in return other than practicing my relevant skills.

There is a lab in our department that I helped with data analysis in June. I've submitted my PhD thesis in August. This lab now came back to my advisor asking for a further work involving testing the correlation between the expressions of 200ish genes and different phenotype in 20ish RNA-seq datasets. My advisor has handed the job to me again.

It is not a small task to me, and since the submission of my PhD thesis my scholarship has stopped so I have to work to pay the bills. Also, I feel unappreciated because the other lab doesn't even know I am the person doing the job, and they will probably list my advisor as a co-author should there be a paper. 

I'd like to know if I should turn down the request, even if it will potentially result in my advisor rejecting a recommendation letter? My advisor once jokingly mentioned that they are holding their recommendation letters hostage so I have to continue working for them (for free). I've done tons of unrelated and unpaid works for them and this project feels like the last straw.
Very politely notify them your scholarship and RA position (or whatever it is called that requires you to do work in return for money) has ended, and offer a consulting rate to continue. Make sure there's an agreed-upon number of hours for each task, so they aren't thinking they can give you one hour of work at a time, when the emails alone take longer than that. Research in most fields doesn't happen unless there is a fountain of money behind it, so this is not as beyond the pale as it may seem from your perspective. Just be careful to make clear it is simply the economic situation of the real world (which apparently they forgot they live in) that is the issue, not that you are making these demands to be unhelpful and make them go away.

If they can't pay you, then you can offer to help someone else take over the work, for example by giving them a list of steps and answering their questions via email.

Or you can offer to help in exchange for co-authorship, but then make sure you get into the loop so it is clear to all that they are violating journal terms by not including you as a co-author. If they are dependent on your analysis for their paper at this point, they may put in a position where you are compelled by professionalism to help them finish, but of course this needs to be out in the open with a promise of at least co-authorship in return. 

Everyone with valuable skills has to deal with this kind of thing. People will push until you push back. The overwhelming majority aren't necessarily as cutthroat as the occasional bad joke might imply; they just convinced themselves your time is near-worthless while theirs is precious. Clarify to them this is not the case anymore.