How can I expand on a normal Craft query to sort by a column in a custom table?
You can't do this using the craft.entries tag in twig. You'll need to create a new function in your plugin that returns the entries in your custom order.

Assuming you can create an array of element ids in your custom order then the following code should allow you to then fetch entries in that order:

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);

// filter entries by element ids
$criteria-&gt;setAttribute('id', $elementIds);

// order entries by element ids
$criteria-&gt;setAttribute('order', 'FIELD(elements.id, '.join(', ', $elementIds).')');

// get entries
$entries = craft()-&gt;elements-&gt;findElements($criteria);