When you make one desperate, final attempt to do something, it's a last-ditch effort. In a last-ditch attempt to win the student council election, you might find yourself promising to put a soft-serve machine in the cafeteria.
The term last-ditch comes from William of Orange's 17th-century vow to defend the Dutch Republic from France and Britain to the death. Or as he's reported to have said, "I mean to die in the last ditch." The expression didn't really catch on until around 1900, when people started using it to mean "final attempt." In a last-ditch effort to convince your parents to get a dog, try inundating them with cute puppy photos you find online.