Here's an old tutorial from last Christmas for a knitted cupcake ornament:
I sort of made the pattern up as I went along, and I was inspired by many of the things I saw here: http://softiescentral.typepad.com/blog/cupcake_wars/index.html.
I don't have an exact pattern, but I can provide a brief outline of the techniques I used:
I used 4dp needles, size 4 or 5.
I cast on 6 st
Row 1&2: K2, add 1
Row 3 (until I made the base as large as I wanted), knit 3, add 1 all the way around.
When I finished the base to an appropriate size (about 2.5 - 3 inches), I used crossed stitch ribbing:
Row 1: Cross 2 RK, P1 all the way to end of row, repeat every other row
Row 2: K2, P1 all the way to end of row, repeat every other row
I did this until the cup was as tall as I wanted, then I knit one row all the way around.
For the cup top, I used a picot hem to make it look more like a paper cup.
Picot hem: K 2tog, yo, repeat to end of row
Next row: knit all the way around
To finish the picot hem, I folded on the picot hem row and stitched it down with yarn of the same color. Don't do this part until the "cake" part is finished.
I just switched to a brown color yarn and knit 3 rows, then decreased 1 st every 3 sts for one row.
After that, I knit 2 more rows, then decreased by the same amount as before.
From there, I knit one more row, then took the yarn end and ran it through the knit loops with a yarn needle to finish off the cake.
Knit with 4 dp needles, size 00
Here I just knit until I had a length about 4 or five inches long.
I knit for 5 or 6 rows, then began to decrease 1 st every 4 sts or so.
I decreased for a couple rows.
Cast on 3 sts
k1, add 1.
Repeat for 5 or 6 rows. This is hard to do on such small needles, but it creates the great wavy effect.
Cast on 10 sts or so.
Knit for 2-3 rows.
Then, k3, add 1 for one row
Knit for 2 rows
K3, decrease 1 for one row
Knit for 2 rows
Knit 3, decrease 1 for two rows, lace yarn end through loops with needle.
Putting it together:
Stuff the cherry and take yarn end through center to create dimple, lace through whipped cream and frosting, tie off with yarn ends from whipped cream and frosting.
Stuff cupcake bottom, take yarn end through center of cup up out of top of bottom section to make bottom more flat. See the crappy diagram, below:
Tie off yarn end from bottom with yarn ends from top.
Stitch on top with pink yarn and yarn needle.